C90: minimum size of long

C

cpp_novice

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?
 
T

Tom St Denis

cpp_novice said:
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
 
F

Flash Gordon

Tom said:
"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.
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.
 
D

Dik T. Winter

> 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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

man gcc doesn't mention -std=c90 2
C90 long long 26
C90 pdf, available from ANSI 5
Writing C90 compatible code 12
Minimum size of void * 24
C90 penetration 98
C89/C90: Returning 0 from main() 8
Questions about C90 vs C99 15

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top