Path: utzoo!utgpu!water!watmath!clyde!att!rutgers!mit-eddie!uw-beaver!tektronix!tekcrl!tekchips!danw From: danw@tekchips.CRL.TEK.COM (Daniel E. Wilson;1432;58-790;;) Newsgroups: comp.lang.c Subject: Re: Absolute size of 'short' Keywords: unsigned wrap-around Message-ID: <2970@tekcrl.CRL.TEK.COM> Date: 21 Aug 88 00:22:05 GMT References: <214@ISIDAPS5.UUCP> <9641@dartvax.Dartmouth.EDU> <62505@sun.uucp> <11794@steinmetz.ge.com> Sender: ftp@tekcrl.CRL.TEK.COM Lines: 22 > 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.