Matthew Hicks <md******@uiuc.eduwrites:
>Can anyone please explain the difference between the following
sample1 and sample2 structures??
struct sample1{
unsigned int a:4;
unsigned int b:4;
};
struct sample2{
unsigned int a:4,
b:4;
};
Does this even compile? The way I learned it, there was no type
between unsigned and the name since it is a series of n bits not a
machine-sized integer.
Please don't top-post; I've fixed it here. Read the following:
http://www.caliburn.nl/topposting.html http://www.cpax.org.uk/prg/writings/topposting.php
I think you're saying that it should be "unsigned a:4;" rather than
"unsigned int a:4;". That's incorrect; both are equally valid. There
are a variety of ways to refer to the predefined integer types; the
names "unsigned int", "unsigned", and even "int unsigned" all mean
exactly the same thing. (I don't recommend using "int unsigned",
though; it's legal due to a quirk in the grammar, but it's confusing.)
--
Keith Thompson (The_Other_Keith)
ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"