question about an array of enum

Chuck.Phillips Chuck.Phillips at FtCollins.NCR.COM
Mon Nov 12 20:35:20 AEST 1990


>>>>> On 6 Nov 90 20:09:27 GMT, karl at ima.isc.com (Karl Heuer) said:
>> Then, some day if the language supports [arrays of bits], you will
>> be able to upgrade painlessly.
>
>Can't happen.  "sizeof (char) == 1" is now fixed in the language, as
>is the fact that it yields an integral type.

Karl> What this really implies is that, if bit arrays are ever supported,
Karl> they won't fit cleanly into the existing language and hence will
Karl> probably not support all the same features as "normal" arrays.

How about if sizeof() returns the smallest number of bytes that are
required to contain a bit array of a given size?  This would require no
changes to malloc(), etc., to incorporate bit arrays.  Most current
architectures require alignment to something larger than a char, anyway.

Of course, other things would be required to robustly implement bit arrays,
(bit pointers, bitsizeof(), etc.) but I don't see that ANSI C has done
anything to prevent this.  In fact, by avoiding the areas of the language
that are now _explicitly_ undefined, one is much less likely to be bit by
bit pointers.  (Sorry, I couldn't resist. :-)

	Just my $0.02,
--
Chuck Phillips  MS440
NCR Microelectronics 			chuck.phillips%ftcollins.ncr.com
2001 Danfield Ct.
Ft. Collins, CO.  80525   		...uunet!ncrlnk!ncr-mpd!bach!chuckp



More information about the Comp.std.c mailing list