This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

-Wdefault-bitfield-sign


While the warning-wishlists are being thrown around I would like to
toss in a few:

struct oink {
  int foo : 5;        // warning: the signedness of foo is implementation defined
  signed int bar : 5; // no warning
  int : 5;            // no warning (since no name)
  int booze : 1;      // warning: dubious signed one-bit bitfield
  signed int baz : 1; // no warning.
};

(A signed bitfield on width one can contain {-1;0} or {0} depending on integer
representation.  The latter allows for impressive optimizations, but surely
someone meant to use unsigned.)

Adding "signed" or "unsigned" as shown would silence the warnings.

Morten


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]