[oclug] What is this (C question)
Gilles J. Seguin
segg at infonet.ca
Thu Apr 19 04:27:29 EDT 2001
Jon Earle wrote:
> Given a variable declaration of the form:
> unsigned int index:10
> What is the ':10' for? I saw this as part of a struct containing 3 or so
> such entries.
It can be used to pack data into bits and give each of those
bits a name as a member of a structure.
But you cannot fetch their address(using &), and you cannot
create pointer to them, Other then these two restrictions,
they are handled in the same way as ordinary variables.
You are choosing space over speed.
The compiler produces the code to properly insert
and extract them at the expense of speed.
More information about the OCLUG