Velocity Reviews > C90: minimum size of long

C90: minimum size of long

cpp_novice
Guest
Posts: n/a

 07-19-2006
What is the minimum size of 'long' according to the ANSI 1990 standard?

I thow that c99 requires longs to be atleast 32bits wide.

Is there an electronic copy of the 1990 standard available online?

Tom St Denis
Guest
Posts: n/a

 07-19-2006

cpp_novice wrote:
> What is the minimum size of 'long' according to the ANSI 1990 standard?
>
> I thow that c99 requires longs to be atleast 32bits wide.
>
> Is there an electronic copy of the 1990 standard available online?

"long" has always been at least upto 2^31 - 1 and down to -2^31.
Unsigned long is at lesst 0...2^32 - 1

Note that doesn't mean that

a) It's incapable of representing things large than 2^31 or 2^32
[resp.]

b) Even if it can only represent upto 2^31/2^32 [resp] that it takes
32 bits to do that [padding/trap bits].

Tom

Flash Gordon
Guest
Posts: n/a

 07-19-2006
Tom St Denis wrote:
> cpp_novice wrote:
>> What is the minimum size of 'long' according to the ANSI 1990 standard?
>>
>> I thow that c99 requires longs to be atleast 32bits wide.
>>
>> Is there an electronic copy of the 1990 standard available online?

>
> "long" has always been at least upto 2^31 - 1 and down to -2^31.

<pedant>
Actually, it is down to at least -(2^31 - 1). I.e., -2^31 might not be
valid, either due to being a trap on a 2s complement system (which I've
not come across) or due to the use of 1s complement or sign-magnitude.
</pedant>

> Unsigned long is at lesst 0...2^32 - 1
>
> Note that doesn't mean that
>
> a) It's incapable of representing things large than 2^31 or 2^32
> [resp.]
>
> b) Even if it can only represent upto 2^31/2^32 [resp] that it takes
> 32 bits to do that [padding/trap bits].

The rest is all correct as far as I can see.
--
Flash Gordon, living in interesting times.
Web site - http://home.flash-gordon.me.uk/
comp.lang.c posting guidelines and intro:
http://clc-wiki.net/wiki/Intro_to_clc

pete
Guest
Posts: n/a

 07-19-2006
cpp_novice wrote:

> Is there an electronic copy of the 1990 standard available online?

http://webstore.ansi.org/ansidocstor...AS+3955%2D1991

--
pete

Dik T. Winter
Guest
Posts: n/a

 07-19-2006
In article <(E-Mail Removed)-gordon.me.uk> Flash Gordon <(E-Mail Removed)> writes:
....
> Actually, it is down to at least -(2^31 - 1). I.e., -2^31 might not be
> valid, either due to being a trap on a 2s complement system (which I've
> not come across) or due to the use of 1s complement or sign-magnitude.

The Gould NP1.
--
dik t. winter, cwi, kruislaan 413, 1098 sj amsterdam, nederland, +31205924131
home: bovenover 215, 1025 jn amsterdam, nederland; http://www.cwi.nl/~dik/