🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

3 total messages Started by Bob Pasker Fri, 22 Jan 1993 17:12
problem report of toupper() in GCC 1.42 on VMS
#860
Author: Bob Pasker
Date: Fri, 22 Jan 1993 17:12
20 lines
823 bytes
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.

-- 
-- 
-- bob pasker
-- rbp@netcom.com
--
Re: problem report of toupper() in GCC 1.42 on VMS
#863
Author: 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.
Re: problem report of toupper() in GCC 1.42 on VMS
#867
Author: Bob Pasker
Date: Sat, 23 Jan 1993 18:16
19 lines
1062 bytes
carl@SOL1.GPS.CALTECH.EDU (Carl J Lydick) writes:

>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')
>It's not totally useless.  It simply must always be used in conjunction with
>islower().  E.g.,
>	c = islower(c) ? toupper(c) : c;

sorry, yes, you're right.  its useful if you have a penchant for a
function that subtracts 32.


-- 
-- 
-- bob pasker
-- rbp@netcom.com
--
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads