Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site fortune.UUCP Path: utzoo!linus!decvax!harpo!eagle!mhuxl!houxm!ihnp4!fortune!jr From: jr@fortune.UUCP Newsgroups: net.lang.c Subject: Question about toupper and tolower Message-ID: <1764@fortune.UUCP> Date: Wed, 9-Nov-83 17:35:42 EST Article-I.D.: fortune.1764 Posted: Wed Nov 9 17:35:42 1983 Date-Received: Fri, 11-Nov-83 02:18:32 EST Organization: Fortune Systems, Redwood City, CA Lines: 23 I have a question about the macros "tolower" and "toupper" (which are usually defined in /usr/include/ctype.h, although they usually don't appear in the manual page (ctype(3)). The UNIX versions of these (including Version 7, System III, and System V) will screw-up the character if it's already the correct case. For instance, in the expression "toupper('A')", 'A' (0x41) becomes '!' (0x21). Now, I realize that it is possible to use: if (islower(c)) c = toupper(c); However, I'm not thrilled by doing that. There are other versions of C which handle this more gracefully (I'm thinking of Aztec C II and BDS C, both for the CP/M operating system). They return the character unchanged if it is already in the correct case. My question is this: other than portability reasons, is there any reason to keep things this way? Wouldn't it make more sense to have toupper and tolower leave the characters alone if they're already right? Does anyone know of any software that would break if the macros were changed? Thanks... -- John Rogers CompuServe: 70140,213 Usenet: ...decvax!decwrl!amd70!fortune!jr