Re: -rc7 Re: Linux 2.4.21-rc6

Miquel van Smoorenburg (miquels@cistron-office.nl)
Wed, 4 Jun 2003 12:35:42 +0000 (UTC)


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/