News for hackers. Stuff that matters.
Re:Some dark corners of C by tobiasu on Saturday March 09, 2013 @07:11AM (#5348170)
Good, because I was missing a slide:

= Bitfields =

Not even once.

;)

Re:Some dark corners of C by rjek on Saturday March 09, 2013 @08:32AM (#5348338)
Everybody knows about bitfields :)
Re:Some dark corners of C by JoshTriplett on Saturday March 09, 2013 @04:07PM (#5349639)
Bitfields have some crazy fun dark corners, though. For instance, which values can this bitfield hold:

    int b:1;
Signed two's-complement n-bit integers can hold values from 2^(n-1)-1 to -2^(n-1), so in theory it can hold 0 and -1, but many compilers get that one wrong. Always declare one-bit bitfields as unsigned. (The Sparse static analyzer will warn you about that one.)