🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #4445

Re: char

#4445
From: James Kanze US/ESC 60/3/141 #407...
Date: Thu, 07 Dec 1995 14:23
39 lines
2182 bytes
In article <DJ3o8r.J94@stdc.demon.co.uk> clive@stdc.demon.co.uk (Clive
D.W. Feather) writes:

|> In article <49uh73$hqp@gabi.gabi-soft.fr>, J. Kanze <kanze@gabi-soft.fr> wrote:
|> > Finally.  So I'm not the only one.  Not only do negative codes sound
|> > odd, they aren't acceptable input for the ctype functions.

|> The ctype functions are defined in terms of "characters cast to unsigned
|> char".

I know what the standard says.  Doesn't make my life any easier.

|> >|>  And can these expressions :
|> >|> (signed char) foo != 0
|> >|>  and
|> >|> (unsigned char) foo != 0
|> >|>  differ in result ?

|> Yes, they can.

|> > "When a value with
|> > integral type is converted to another integral type, if the value can be
|> > represented by the new type, its value is unchanged."  Implementation
|> > limits require that 0 be representable in all integral types.

|> Irrelevant. When a signed char is converted to an unsigned char,
|> negative values are converted in an implementation-defined manner. It
|> may well be that there is a negative value which converts to zero.
|> Provided that this value has the same properties as '\0' as far as the
|> ctype functions are concerned, this is conforming.

Oops.  My mistake, a non-0 value can become zero.  Zero cannot become
non-zero, but as you point out, that isn't sufficient to guarantee the
above.
--
James Kanze         Tel.: (+33) 88 14 49 00        email: kanze@gabi-soft.fr
GABI Software, Sarl., 8 rue des Francs-Bourgeois, F-67000 Strasbourg, France
Conseils, études et réalisations en logiciel orienté objet --
                -- A la recherche d'une activité dans une region francophone
Technical Details
Message-ID: <KANZE.95Dec7152356@slsvewt.lts.sel.alcatel.de>
Path: arc1-ca.pugleaf.net!bln.sel.alcatel.de!slsv6bt!slsv6bt!kanze
References: <49sath$n7k@news.cic.net> <49uh73$hqp@gabi.gabi-soft.fr> <DJ3o8r.J94@stdc.demon.co.uk>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!bln.sel.alcatel.de!slsv6bt!slsv6bt!kanze
From: kanze@lts.sel.alcatel.de (James Kanze US/ESC 60/3/141 #40763)
Subject: Re: char
In-Reply-To: clive@stdc.demon.co.uk's message of Tue, 5 Dec 1995 06:19:38 GMT
Message-ID: <KANZE.95Dec7152356@slsvewt.lts.sel.alcatel.de>
Sender: news@lts.sel.alcatel.de
Organization: SEL
References: <49sath$n7k@news.cic.net> <49uh73$hqp@gabi.gabi-soft.fr>
 <DJ3o8r.J94@stdc.demon.co.uk>
Date: 07 Dec 1995 14:23:54 GMT