On Thu, Jun 19, 2014 at 2:59 PM, Jim Jagielski <j...@jagunet.com> wrote: > > On Jun 19, 2014, at 8:43 AM, yla...@apache.org wrote: > >> Author: ylavic >> Date: Thu Jun 19 12:43:05 2014 >> New Revision: 1603863 >> >> URL: http://svn.apache.org/r1603863 >> Log: >> Use unsigned bit flags (otherwise the non-zero value to be used is -1). >> > > I don't understand that at all... A bit is either 1 or 0. >
Well, it depends on what you are doing with that bit... #include <stdio.h> int main(int argc, const char *argv[]) { struct { int s:1; } bitfield; bitfield.s = 1; if (bitfield.s > 0) { printf("positive\n"); } else { printf("negative or nul\n"); } if (bitfield.s == 1) { printf("one\n"); } else { printf("not one\n"); } return 0; } $ ./bitfield negative or nul not one