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/

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are Off Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post veryhotsausage C++ 1 07-04-2008 05:41 PM Jason Cavett Java 5 05-25-2008 08:32 AM Mathieu Dutour C Programming 4 07-24-2007 11:15 AM Daniel Rudy C Programming 5 09-20-2005 02:37 AM George Marsaglia C Programming 1 07-08-2003 05:16 PM