From 6401770961265424144
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,66c191af91069dde
X-Google-Attributes: gidf78e5,public
From: devphil@my-dejanews.com
Subject: Re: "minimum maxima" for fundamental types
Date: 1998/10/08
Message-ID: <6vgg8d$hc7$1@nnrp1.dejanews.com>#1/1
X-Deja-AN: 398852388
Approved: Fergus Henderson <fjh@cs.mu.oz.au>
References: <3619CE5F.CAFFE468@alcatel.de>
X-Original-Date: Wed, 07 Oct 1998 19:43:09 GMT
X-Http-User-Agent: Mozilla/4.05 [en] (WinNT; U)
X-Complaints-To: news@news.unimelb.edu.au
X-Http-Proxy: 1.0 x13.dejanews.com:80 (Squid/1.1.22) for client 209.64.26.5
X-Trace: izvestia.its.unimelb.edu.au 907813763 27223 128.250.29.17 (8 Oct 1998 02:29:23 GMT)
Organization: $home is where the core is
X-Article-Creation-Date: Wed Oct 07 19:43:09 1998 GMT
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUANhwjauEDnX0m9pzZAQGmZAF/cfieIUY+qKEHZegXQtuGXAgTtzi7RFCC 9wo+PDy+upO70P1y0DlR9iPjSxBqWd+Y =POFT
NNTP-Posting-Date: 8 Oct 1998 02:29:23 GMT
Newsgroups: comp.std.c++

[Cc'd to poster]

In article <3619CE5F.CAFFE468@alcatel.de>,
  Fritz Bosch <FBosch@alcatel.de> wrote:
>
> The ISO C standard defines "minimum maxima" for the values values of
> fundamental types, e.g.:
>
>   int:          -32767       to  32767
>   unsigned int:  0           to  65535
>   long:         -2147483647  to  2147483647
>
> The C++ standard (actually the Public Review Document) is not that
> specific:
[3.9.1]/2
>   2 There are four signed integer types: "signed char", "short int",
>     "int", and "long int." In this list, each type provides at least as
>     much storage as those preceding it in the list. Plain ints have the
>     natural size suggested by the architecture of the execution
>     environment; the other signed integer types are provided to meet
                  ^
                  ^
                  ^

The footnote at this point in the published Standard adds, "that is,
large enough to contain any value in the range of INT_MIN and INT_MAX,
as defined in the header <climits>."

So there are /some/ minimum and maximum values for int given, beyond
the normative reference to the C Standard; you just have to use the
preprocessor and/or numeric_limits<> to see what they are.  :-)  I
suspect that the "hardcoded" ISO C requirements are a little outdated;
a quick grep on an older-but-still-useful platform gives me this for
'int' and 'unsigned int':

    [monkey 115]> grep INT_MIN /usr/include/limits.h
    #define INT_MIN         (-2147483647-1)
    [monkey 116]> grep INT_MAX /usr/include/limits.h
    #define INT_MAX         2147483647
    #define UINT_MAX        4294967295U
    [monkey 117]>

Which is a little bit beyond the 65536-range...


Luck++;
/dev/phil

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]



