Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > C90: minimum size of long

Reply
Thread Tools

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?

 
Reply With Quote
 
 
 
 
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

 
Reply With Quote
 
 
 
 
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
 
Reply With Quote
 
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
 
Reply With Quote
 
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/
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Having compilation error: no match for call to (const __gnu_cxx::hash<long long int>) (const long long int&) veryhotsausage C++ 1 07-04-2008 05:41 PM
Preferred Size, Minimum Size, Size Jason Cavett Java 5 05-25-2008 08:32 AM
long long and long Mathieu Dutour C Programming 4 07-24-2007 11:15 AM
unsigned long long int to long double Daniel Rudy C Programming 5 09-20-2005 02:37 AM
Assigning unsigned long to unsigned long long George Marsaglia C Programming 1 07-08-2003 05:16 PM



Advertisments