integer types, sys calls, and stdio

Jonathan P. Leech jon at cit-vax
Tue Jan 15 06:06:31 AEST 1985


    In article <631 at turtlevax.UUCP>, Ken Turkowski <turtlevax!ken> writes:
> Chars have always been 8 bits, shorts always 16, and longs always 32.
> I would suggest that you keep as close to this as possible.  Int has
> varied between 16 and 32 bits; hell, why not make it 64? :-)
> viz,
>
>	  char	  = 9 bits	  (S-1 quarterword)
>	  short   = 18 bits	  (S-1 halfword)
>	  long	  = 36 bits	  (S-1 singleword)
>	  int	  = 72 bits	  (S-1 doubleword)
>
> --
> Ken Turkowski @ CADLINC, Menlo Park, CA

    Why not? Perhaps Appendix A, section 4 (p. 182) of K&R:
	"Up to three sizes of integer, declared short  int,  int,  and
	long int, are available.   Longer  integers  provide  no  less
	storage than shorter ones."
    Also, if you apply the type conversion rules in  section  6.6,  an
	operation involving a (36 bit) long and a (72  bit)  int  will
	have result type of long, losing precision.
    Does anyone know what the ANSI standard says about this?

    Jon Leech
    jon at cit-vax.arpa



More information about the Comp.unix.wizards mailing list