🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1951

Re: Re: question about an array of enum

#1951
From: Karl Botts
Date: Thu, 08 Nov 1990 02:50
26 lines
1586 bytes
>>Can't happen.  "sizeof (char) == 1" is now fixed in the language, as
>>is the fact that it yields an integral type.
>
>What this really implies is that, if bit arrays are ever supported, they won't
>fit cleanly into the existing language and hence will probably not support all
>the same features as "normal" arrays.

I don't see how this follows.  Given the new fundamental type "bit" (a
keyword) then it does follow that:

main()
{
	bit	bits[1];
	printf("%d\n", sizeof(bits));
}

must print (at least) "1".  This is OK; sizeof produces the amount of
storage needed to hold an object, not the actual size of the object.
I would expect sizeof applied to an array of 8 bits to also return 1, tho
of course this would be implementation dependent.

Accessing elements of such an array would no doubt generate a little more
code, probably involving the use of a mask, than accessing an element of an
array of char; also, the address of an element of a bit array would likely
be wider than addresses of other objects.  But none of this is against the
rules.
Technical Details
Message-ID: <1990Nov08.025037.8594@chinet.chi.il.us>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!orc!inews!iwarp.intel.com!gargoyle!chinet!kdb
References: <9130019@hpavla.AVO.HP.COM> <MCDANIEL.90Nov6114504@dolphin.adi.com> <1990Nov06.200927.28712@dirtydog.ima.isc.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!orc!inews!iwarp.intel.com!gargoyle!chinet!kdb
From: kdb@chinet.chi.il.us (Karl Botts)
Newsgroups: comp.std.c
Subject: Re: Re: question about an array of enum
Message-ID: <1990Nov08.025037.8594@chinet.chi.il.us>
Date: 8 Nov 90 02:50:37 GMT
References: <9130019@hpavla.AVO.HP.COM> <MCDANIEL.90Nov6114504@dolphin.adi.com> <1990Nov06.200927.28712@dirtydog.ima.isc.com>
Organization: Chinet - Public Access UNIX
Lines: 26