Article View: comp.std.c
Article #3960Re: Type of expression
From: Lawrence Kirby
Date: Sat, 09 Sep 1995 01:25
Date: Sat, 09 Sep 1995 01:25
25 lines
1707 bytes
1707 bytes
In article <DEHyMv.E4r@stdc.demon.co.uk>
clive@demon.net "Clive D.W. Feather" writes:
>In article <DEG4C6.6Ao@polo.demon.co.uk>,
>John Winters <john@polo.demon.co.uk> wrote:
>> Surely 0x80000000L is only too big for a long int on a 32 bit machine
>> if you intend it to be interpreted as a positive number? It fits in a
>> 32 bit signed int fine, and represents -2147483648.
>
>The C expression 0x80000000L is a way of writing the value 2147483648.
>It is always a positive value. Since it won't fit in a 32-bin long int,
>the language gives it the type unsigned long int.
It may be worth noting that all integer constants represent positive values
(perhaps there are theoretical circumstances where a character constant
could end up negative). In particular something like -1 is equivalent to
-(1) i.e. the integer constant 1 to which is applied the unary - operator.
The result is an integral constant expression with a negative value, not an
integer constant.
--
-----------------------------------------
Lawrence Kirby | fred@genesis.demon.co.uk
Wilts, England | 70734.126@compuserve.com
-----------------------------------------
Technical Details
Message-ID:
<810609935snz@genesis.demon.co.uk>Path:
arc1-ca.pugleaf.net!mail2news.demon.co.uk!genesis.demon.co.ukReferences:
<42df0h$73v@elf.bsdi.com> <42eu5d$jmq$1@mhafm.production.compuserve.com> <DEG4C6.6Ao@polo.demon.co.uk> <DEHyMv.E4r@stdc.demon.co.uk>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!mail2news.demon.co.uk!genesis.demon.co.uk From: Lawrence Kirby <fred@genesis.demon.co.uk> Newsgroups: comp.std.c Subject: Re: Type of expression Date: Sat, 09 Sep 95 01:25:35 GMT Organization: none Message-ID: <810609935snz@genesis.demon.co.uk> References: <42df0h$73v@elf.bsdi.com> <42eu5d$jmq$1@mhafm.production.compuserve.com> <DEG4C6.6Ao@polo.demon.co.uk> <DEHyMv.E4r@stdc.demon.co.uk> Reply-To: fred@genesis.demon.co.uk X-NNTP-Posting-Host: genesis.demon.co.uk X-Newsreader: Demon Internet Simple News v1.27