On Wed, 10 May 2000, Caolan McNamara wrote:
These are not initializers, in this context : is to specify bitfields.
ah.. now that you say it, it sounds familiar. :)
i can't remember what i'm trying to think of.. some gcc extensions to
do with creating pre-initialised structs[1] (i think). used in linux
source in places... iirc. (but i'm probably utterly wrong).
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)
why slow?
(eg if i had a lot of flags, and low-ranged integers, eg status
codes.. wouldn't i be much better off using bitfields to pack them
into a single 32 bit word? rather than having seperate variables,
where most of the space isn't used?)
what about 64bit machines? where you might waste even more space with
the standard variable sizes?
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
i was thinking of something else.
C.
oh.. and apologies for the array mistake. for some reason i thought
arrays were declared with array[n], ie if i want the last element to
be array[9] i declare it as array[9].. doh... :)
--
Paul Jakma paul at clubi.ie
PGP5 key: http://www.clubi.ie/jakma/publickey.txt
-------------------------------------------
Fortune:
In Corning, Iowa, it's a misdemeanor for a man to ask his wife to ride
in any motor vehicle.
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!