Absolute size of 'short'

Daniel E. Wilson;1432;58-790;; danw at tekchips.CRL.TEK.COM
Sun Aug 21 10:22:05 AEST 1988


> I proposed something like this to X3J11 in the first year or so (I was
> only there two years). What I suggested was size in bytes, allowing:
> 	int foo*4
> 	-or-
> 	int*4 foo;
> The feeling was that it was (a) not really needed and (b) too much like
> fortran. I like your idea better, but the few cases where you want exact
> size rather than minimum size probably don't justify inclusion.

     I thought this was C not FORTRAN 77.  The reason why the size of an
int is not tightly defined is so that the compiler will use the  
best size for the computer.  Usually so the program will wind up being
faster.  

> I would really like to see a "packed struct," also. 

    It would seem that a well written compiler would already choose the
best alignments of members in a structure.  Also remember that some
types of hardware can't address a word on a byte boundry (PDP-11) and
so this option would end up not being implemented.  A good 80x86 compiler
would probably not pad a structure because the hardware doesn't care how
an int is aligned.



More information about the Comp.lang.c mailing list