Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!rutgers!apple!bionet!agate!helios.ee.lbl.gov!nosc!ucsd!ucsdhub!esosun!seismo!uunet!auspex!guy From: guy@auspex.UUCP (Guy Harris) Newsgroups: comp.lang.c Subject: Re: getch() and getche() in MSC 4.0 Keywords: *##%@^!&ing functions! Message-ID: <315@auspex.UUCP> Date: 27 Oct 88 17:13:52 GMT References: <10508@dartvax.Dartmouth.EDU> <10523@dartvax.Dartmouth.EDU> <236@shockeye.UUCP> Reply-To: guy@auspex.UUCP (Guy Harris) Organization: Auspex Systems, Santa Clara Lines: 31 >Okay, I'm confused. We've got a System V Release 1conv(3c) says that toupper is a function and _toupper is the macro. >We've got a Genix (4.1BSD) system that says toupper is a macro (and notes >that it is the same as SysV _toupper.) Turbo C agrees with SysV. > >How many systems have it which way? (I know. It is unwise to depend on >"toupper" in portable programs...) UNIX V7 had "toupper" a macro, with no "_toupper". I think they renamed that macro "_toupper" and added the function "toupper" - which, unlike the macro, is supposed to leave characters that aren't lower-case letters alone, rather than performing unnatural acts on them - in S5 (it may have been S3). 4.xBSD didn't pick up the S5 stuff; it stuck with the V7 version. Systems based on V7 or 4.xBSD (and maybe S3) that haven't made themselves S5-compatible will probably have "toupper" as a macro; systems that have made themselves S5-compatible will have it as a function, at least in their S5-compatbile environment - if they also offer a BSD-compatible environment, it will probably be a macro in that environment. I suspect most of the microcomputer systems will work in S5 fashion. VAX C probably does it in BSD fashion. K&R Second Edition, based on some ANSI C draft, specifies that "toupper" must work in the S5 fashion (leaving characters that aren't lower-case letters alone), although (not having a draft handy) I don't know whether ANSI C allows this to be done with a macro or not. It doesn't say anything about "_toupper", so I assume it's not guaranteed to exist in an ANSI C implementation.