getch() and getche() in MSC 4.0
Guy Harris
guy at auspex.UUCP
Fri Oct 28 03:13:52 AEST 1988
>Okay, I'm confused. We've got a System V Release 1<n<2 system here, and
>conv(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.
More information about the Comp.lang.c
mailing list