🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #863

Re: problem report of toupper() in GCC 1.42 on VMS

#863
From: Carl J Lydick
Date: Sat, 23 Jan 1993 00:37
33 lines
1983 bytes
In article <1993Jan22.171257.28021@netcom.com>, rbp@netcom.com (Bob Pasker) writes:
=GNU_CC_INCLUDE:[000000]ctype.h has the following utterly useless
=definition of toupper():
=
=	#define toupper(c)      ((c)-'a'+'A')
=
=since there exists a properly functioning routine in the RTL, the
=proper definition is:
=
=	char toupper(char);
=
=or, if you don't like the CALLS, roll yer own #define that makes
=(toupper('A') == toupper('a')) be a true value.
=
=tolower() is similarly brain dead.

It's not totally useless.  It simply must always be used in conjunction with
islower().  E.g.,
	c = islower(c) ? toupper(c) : c;
or
	c = isupper(c) ? tolower(c) : c;

Of course, then you've got to worry about side-effects.  I can't, at the
moment, any way, think of a way to implement toupper() via a macro that doesn't
use its argument at least twice and that has the check for islower() built in.
--------------------------------------------------------------------------------
Carl J Lydick | INTERnet: CARL@SOL1.GPS.CALTECH.EDU | NSI/HEPnet: SOL1::CARL

Disclaimer:  Hey, I understand VAXen and VMS.  That's what I get paid for.  My
understanding of astronomy is purely at the amateur level (or below).  So
unless what I'm saying is directly related to VAX/VMS, don't hold me or my
organization responsible for it.  If it IS related to VAX/VMS, you can try to
hold me responsible for it, but my organization had nothing to do with it.
Technical Details
Message-ID: <1jq415INNhrv@gap.caltech.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!elroy.jpl.nasa.gov!nntp-server.caltech.edu!SOL1.GPS.CALTECH.EDU!CARL
References: <1993Jan22.171257.28021@netcom.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!elroy.jpl.nasa.gov!nntp-server.caltech.edu!SOL1.GPS.CALTECH.EDU!CARL
From: carl@SOL1.GPS.CALTECH.EDU (Carl J Lydick)
Newsgroups: gnu.gcc.help,comp.os.vms
Subject: Re: problem report of toupper() in GCC 1.42 on VMS
Date: 23 Jan 1993 00:37:57 GMT
Organization: HST Wide Field/Planetary Camera
Lines: 33
Distribution: world
Message-ID: <1jq415INNhrv@gap.caltech.edu>
References: <1993Jan22.171257.28021@netcom.com>
Reply-To: carl@SOL1.GPS.CALTECH.EDU
NNTP-Posting-Host: sol1.gps.caltech.edu