Uses of "short" ?

Joseph S. D. Yao jsdy at hadron.UUCP
Tue Oct 29 11:26:07 AEST 1985


In article <2883 at sun.uucp> guy at sun.uucp (Guy Harris) writes:
>One can write:
>	int	size_of_UNIX_file;
>or one can write
>	long	size_of_UNIX_file;
>The former is incorrect, and the latter is correct.  ...

Actually, if you are trying to write portable code, NEITHER is correct.
This particular problem is exactly why we have the typedef, off_t.

	off_t size_of_UNIX_file;

is correct for portable code.

However, either of the above is correct for throwaway code on machines
for which each one happens to be true.  The trouble is, by not
developing good (read innocuous but portable) habits in throwaway code,
if you suddenly decide that you are an Implementor of Portable Code,
you will have a lot of trouble get used to the "new" way of writing
code.
-- 

	Joe Yao		hadron!jsdy at seismo.{CSS.GOV,ARPA,UUCP}



More information about the Comp.lang.c mailing list