[ILUG] gcc optimisation weirdness?

Caolan McNamara cmc at stardivision.de
Wed May 10 18:50:59 IST 2000


>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<
On 10.05.00, 19:14:08, Paul Jakma <paulj at itg.ie> wrote regarding RE: [ILUG] 
gcc optimisation weirdness?:

> Ken Frightened us with..
> > GCC also has some extensions that allow
> > you to do fancied stuff with initializers.

I knew that info was the spawn of satan, look at the evils that live in 
there. Get out of that compiler extension section before you confuse the 
hell out of me as to whats standard C and whats not.

> the : operator, right? don't remember exactly how it works, but something
> like:

> struct foo {
>       int var : 0;
>       char bar : NULL;
> } foobar;
> it used in a few places in the linux source.

These are not initializers, in this context : is to specify bitfields. 
You can create a variable that refers to a unit whose size can be 
specified in bits. (and before people go mad using the damn things, the 
bitfields are collated together to form integral units (possible bytes, 
probably 32bit ints) and they are as slow as molasses)

i.e. 
int apple:4; creates a var apple which is 4bits long. 
You would not see :NULL in reality and god only knows what :0 would do

C.




More information about the ILUG mailing list