int16, int32

Guy Harris guy at sun.uucp
Mon Aug 12 06:14:57 AEST 1985


> I beg to differ: I tend to use "int" when 16 bits will suffice and
> I'm not concerned with data space, and I think many others would do
> the same, especially since the 4BSD Vax PCC compiler (and probably
> many other compilers (SysV Vax PCC?)) won't put "register short"s
> into registers.  (Someday, someone should fix that....)

Since "int" is supposed to be the "natural" size of integers on a particular
machine, this is the correct thing to do when 16 bits is sufficient but more
bits doesn't hurt (i.e., if data space isn't a problem or if the item is in
a structure which isn't seen by other pieces of hardware).

The S5 VAX PCC puts "register short"s into registers.  The S3 VAX PCC did,
also, but produced the "poor and sometimes incorrect" code that the 4.xBSD
manual referred to; that's why Berkeley change the S3 VAX PCC not to put
them into registers.  I looked at a couple pieces of code from the S5 VAX
PCC.  It seemed to do some possibly-unnecessary work, but that may be due to
the semantics of sub-longwordlength-arithmetic in C and on the VAX.  (I
don't know what the "poor and sometimes incorrect" code was, so I wasn't
able to see if the S5 VAX PCC generated it or not.)

	Guy Harris



More information about the Comp.lang.c mailing list