_tolower and _toupper macros

Bruce Worden bruce at seismo.gps.caltech.edu
Sun Jul 29 05:32:55 AEST 1990


In article <246 at audfax.audiofax.com> arnold at audiofax.com (Arnold Robbins) writes:
>In article <1990Jul26.100721.14628 at warwick.ac.uk> cuuee at warwick.ac.uk (Sean Legassick) writes:
>>	Does anyone know what ANSI has to say about these conversion
>>routines? It would seem that using them on any other character except
>>for capitals with _tolower and lowercase with _toupper is pretty
>>non-portable code writing. Comments?

Nice explanation of the history of these functions deleted...

>I guess tolower() and toupper() remain real functions in V.3.2 in case
>anyone takes their address; I can't see any other reason to not have them
>be macros identical to their _to* counterparts.

I don't believe that this is the reason for implementing to*() as functions.
The most important reason is so that these functions can work on 
non-US-ascii character sets (i.e. they will continue to function correctly 
after a call to setlocale() which changes the LC_CTYPE locale.)  
Another important reason is to avoid multiple evaluations of the argument 
as has been discussed elsewhere.
						Bruce



More information about the Comp.lang.c mailing list