> I checked my compiler's documentation, and it says,
> "In C, you can declare a bit field as type int, signed int, or unsigned int.
> Bit fields of the type int are equivalent to those of type unsigned int."
And ANSI(R) X3.159-1989 says:
3.5.2.1 Structure and Union Specifiers
...
A bit-field shall have a type that is a qualified or
unqualified version of one of "int", "unsigned int", or "signed
int". Whether the high-order bit position of a (possibly
qualified) ``plain'' "int" bit-field is treated as a sign bit is
implementation defined. A bit-field is interpreted as an
integral type consisting of the specified number of bits.
which is the ANSI C-language version of the same thing ("qualified"
types are types with "const" and/or "volatile" added; "short" and "long"
aren't qualifiers).
> So would it break things horribly if I changed lines like:
> guint8 rrr_forbidden : 1;
>
> to
>
> gint32 rrr_forbidden: 1;
No, it would remove from the code one place where it's going beyond what
the ANSI C standard requires.
However, I'd be inclined to use "guint32", just to indicate that the
field is *intended* to be unsigned, even though the compiler won't
necessarily treat it as such on all platforms (the "u", or the
"unsigned", amounts to a comment, if you will...).
Powered by MHonArc 2.6.10