Programming and international chara

Doug Gwyn gwyn at smoke.BRL.MIL
Wed Nov 9 20:37:37 AEST 1988


In article <44200016 at uicsrd.csrd.uiuc.edu> mcdaniel at uicsrd.csrd.uiuc.edu writes:
>	#define iscntrl(c)	( (c) >= 0 && (c) <= 037 )

This is an invalid implementation.  The is*() functions may be implemented
as macros only if they are "safe" macros (i.e. evaluate the argument only
once).  Also, for valid arguments (ints in the range 0..CHAR_MAX and EOF)
the only negative argument that must be handled is EOF.

>                . . . Isascii and toascii are defined on all
>     integer values; the rest are defined only where isascii is
>     true and on the single non-ASCII value EOF (see stdio(3S)).

Because ANSI C does not have an isascii() function, the is*() tests
are required to work right for all character values.



More information about the Comp.lang.c mailing list