Uses of "short" ?

hamilton at uiucuxc.CSO.UIUC.EDU hamilton at uiucuxc.CSO.UIUC.EDU
Thu Oct 10 06:11:00 AEST 1985


too bad you can't do something like:
	#define INT(max)	\	/* /usr/include/int.h */
	#if max<32768		\	/* machine-dependent */
		short		\
	#else			\
		long		\
	#endif

	INT(20000) x;		/* -> short x; */
	INT(50000) y;		/* -> long y; */
with cpp.  maybe m4?  not real pretty, but then neither is "int16", etc.
i think it makes more sense to declare value range(s) than significant
bits.  at the least, it provides an extra degree of self-documentation.
(quick, somebody make me shut up before i say something nice about pascal!)

	wayne hamilton
UUCP:	{ihnp4,pur-ee,convex}!uiucdcs!uiucuxc!hamilton
ARPA:	hamilton at uiucuxc.cso.uiuc.edu
CSNET:	hamilton%uiucuxc at uiuc.csnet
USMail:	Box 476, Urbana, IL 61801
Phone:	(217)333-8703



More information about the Comp.lang.c mailing list