🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.c
Article #9755

Re: Signed char - What Foolishness Is This!

#9755
From: Joseph S. D. Yao
Date: Fri, 07 Nov 1986 06:35
18 lines
1510 bytes
In article <228@apple.UUCP> mikes@apple.UUCP (Mike Shannon) writes:
>In <8719@duke.duke.UUCP> jwg@duke.UUCP (Jeffrey William Gillette) writes:
>>MSC 4.0 defaults 'char' to 'signed char'.  ...
>>             This works great when c = 65 ('A'), but when c = 154
>>('U'umlaut) the macro produces the following: ( (_ctype+1)[-102] & UPPER )
>> ....

The standard (K&R, and now X3J11) has always held that 'char' is
signed or unsigned, depending on the machine.  For good, usable,
portable code I've tended to do arithmetic ops (such as indexing
an array) in shorts or ints, masking input chars.  This is also
great for testing EOF ...  Also, the ctype macros should NOT be
used with any char > 0177, simply because many or most current
implementations only use a buffer that large.
-- 

	Joe Yao		hadron!jsdy@seismo.{CSS.GOV,ARPA,UUCP}
			jsdy@hadron.COM (not yet domainised)
Technical Details
Message-ID: <606@hadron.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!rutgers!seismo!sundc!netxcom!hadron!jsdy
References: <8719@duke.duke.UUCP> <228@apple.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!rutgers!seismo!sundc!netxcom!hadron!jsdy
From: jsdy@hadron.UUCP (Joseph S. D. Yao)
Newsgroups: net.lang.c,net.micro.pc
Subject: Re: Signed char - What Foolishness Is This!
Message-ID: <606@hadron.UUCP>
Date: Fri, 7-Nov-86 01:35:33 EST
Article-I.D.: hadron.606
Posted: Fri Nov  7 01:35:33 1986
Date-Received: Sat, 8-Nov-86 07:02:17 EST
References: <8719@duke.duke.UUCP> <228@apple.UUCP>
Reply-To: jsdy@hadron.UUCP (Joseph S. D. Yao)
Organization: Hadron, Inc., Fairfax, VA
Lines: 18
Summary: Suggestions for portable usage.