Absolute size of 'short'

thad at cup.portal.com thad at cup.portal.com
Tue Aug 16 20:42:22 AEST 1988


Interesting this subject is coming up!  I implemented the following in one C
compiler to assure compatibility with existing assembler structures, and it
has been a lifesaver:

       bit[:n]  name;

which defaults to a one-bit-wide

Some examples:

      bit    DiskBitmap[_SECTORS];

      bit:2  foo;

Makes for extrememly readable AND maintainable code.

There are situations where storage compaction is of far greater importance
than the access time (e.g. in one of my DBMS products).

Constructs such as the following do NOT function "properly" with most compilers:

     struct OneBitElement {
          int  foo : 1;
     };

     struct MyDataBlock {
          int  bar;
          struct OneBitElement bletch[32];
     };

I cannot believe I'm the only one with this requirement.  Sheesh.



More information about the Comp.lang.c mailing list