Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!mintaka!spdcc!ima!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: Is there a good example of how toupper() works? Message-ID: <18575@haddock.ima.isc.com> Date: 18 Oct 90 21:49:00 GMT References: <2466@ux.acs.umn.edu> <1990Oct17.170914.683@wpi.WPI.EDU> Reply-To: karl@ima.isc.com (Karl Heuer) Organization: Interactive Systems, Cambridge, MA 02138-5302 Lines: 22 In article <1990Oct17.170914.683@wpi.WPI.EDU> profesor@wpi.WPI.EDU (Matthew E Cross) writes: >Nope, won't work - the return value of 'toupper' is undefined if the input is >not a lowercase character. Fixed in ANSI C. For those who are using pre-ANSI systems where this doesn't hold, I recommend coding in ANSI style, and writing your own ANSI-compatible headers and libraries as needed. This minimizes the trauma when you finally graduate to ANSI C. My personal ansi/ctype.h is: #include "/usr//include/ctype.h" #undef tolower #undef toupper #if defined(__STDC__) extern int toupper(int); extern int tolower(int); #else extern int toupper(); extern int tolower(); #endif Karl W. Z. Heuer (karl@ima.isc.com or uunet!ima!karl), The Walking Lint