Uses of "short" ?

Mike I'll be mellow when I'm dead Meyer mwm at ucbopal.BERKELEY.EDU
Wed Oct 9 11:15:43 AEST 1985


In article <1924 at brl-tgr.ARPA> gwyn at brl-tgr.ARPA (Doug Gwyn <gwyn>) writes:
>> I am inclined to prefer the use of int16, int32, int64, int8, char.
>
>int16 => short
>int32 => long
>int64 => not a primitive data type on all implementations
>int8  => signed char
>char  => char
>
>Why add more symbols when you already have what is needed in the language?

Doug,

If someone on a machine that supports 60+ bit ints uses one in their code,
and later you have to port it, you should hope they did:

typedef	long	int60 ;		/* or whatever the type is for 60 bit ints */

and then used int60 instead of long.

You see, if they do that, then when you compile the program and notice it
giving you funny numbers (assuming, of course, that you notice :-), a single
grep will find all the places where variables you need to worry about are
declared.

Of course, if there were some standard place to look for those typedefs, and
they had included that, then when you compiled the program, it would give
you the same list as the grep.

Likewise, if *your* code uses int8/int16/whatever correctly, specifying the
number of bits needed, then there file of typedefs will get them a
reasonable type for those variables.

	<mike



More information about the Comp.lang.c mailing list