🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3977

Re: Type of expression

#3977
From: Clive D.W. Feather
Date: Tue, 12 Sep 1995 21:28
20 lines
1584 bytes
In article <DEstEs.7wJ@polo.demon.co.uk>,
John Winters <john@polo.demon.co.uk> wrote:
> Could you quote a reference for this please?  (Genuine request for
> enlightenment - not an attempt to dispute it.)  I've looked at the standard,
> and clearly the syntax of decimal integer constants excludes the
> possibility of them being negative, but I can't find anywhere where it
> says that hex constants must be interpreted as positive.

It explains that the value is interpreted in base 16, and then talks
about the first type from a list in which the value can be represented.
Since value is clearly, in this context, independent of type, it must be
being treated in the pure mathematical sense and so is positive. The
rules for determining the actual type always end up in an unsigned type
if the signed one is incapable of holding the value, so the value always
ends up nonnegative.

-- 
Clive D.W. Feather                       | If you lie to the compiler,
clive@demon.net        (work, preferred) | it will get its revenge.
clive@stdc.demon.co.uk (home)            |   - Henry Spencer
Technical Details
Message-ID: <DEtABB.uK@stdc.demon.co.uk>
Path: arc1-ca.pugleaf.net!stdc.demon.co.uk!clive
References: <42df0h$73v@elf.bsdi.com> <DEHyMv.E4r@stdc.demon.co.uk> <810609935snz@genesis.demon.co.uk> <DEstEs.7wJ@polo.demon.co.uk>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!stdc.demon.co.uk!clive
From: clive@stdc.demon.co.uk (Clive D.W. Feather)
Newsgroups: comp.std.c
Subject: Re: Type of expression
Date: Tue, 12 Sep 1995 21:28:22 GMT
Organization: Demon Internet Limited (personal account)
Message-ID: <DEtABB.uK@stdc.demon.co.uk>
References: <42df0h$73v@elf.bsdi.com> <DEHyMv.E4r@stdc.demon.co.uk> <810609935snz@genesis.demon.co.uk> <DEstEs.7wJ@polo.demon.co.uk>
Reply-To: clive@demon.net
X-NNTP-Posting-Host: stdc.demon.co.uk