Re: -rc7 Re: Linux 2.4.21-rc6

From: Miquel van Smoorenburg (miquels@cistron-office.nl)
Date: Wed Jun 04 2003 - 07:35:42 EST


In article <3EDDDEBB.4080209@cyberone.com.au>,
Nick Piggin <piggin@cyberone.com.au> wrote:
>- char plugged;
>+ int plugged:1;

This is dangerous:

struct foo {
        int bla:1;
};
 
int main()
{
        struct foo f;
 
        f.bla = 1;
        printf("%d\n", f.bla);
}

$ ./a.out
-1

If you want to put "0" and "1" in a 1-bit field, use "unsigned int bla:1".

Mike.

-- 
.. somehow I have a feeling the hurting hasn't even begun yet
	-- Bill, "The Terrible Thunderlizards"

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Jun 07 2003 - 22:00:23 EST