This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: numeric_limits problem
- To: egcs at cygnus dot com
- Subject: Re: numeric_limits problem
- From: Nathan Myers <ncm at nospam dot cantrip dot org>
- Date: Tue, 08 Sep 1998 15:35:28 -0700
- Newsgroups: cygnus.egcs
- Organization: http://www.cantrip.org/
- References: <Pine.LNX.3.96.980906123253.29912B-100000.cygnus.egcs@alpha.computers.org>
Iztok Polanic wrote:
> I want to compile this program with egcs, but I get an error.
>
> #/usr/local/bin/g++ 3.3.cpp -o test
> 3.3.cpp: In function `int main()':
> 3.3.cpp:9: `numeric_limits' undeclared (first use this function)
> 3.3.cpp:9: (Each undeclared identifier is reported only once
> 3.3.cpp:9: for each function it appears in.)
> 3.3.cpp:9: parse error before `>'
> 3.3.cpp:14: confused by earlier errors, bailing out
>
> and here's the program
>
> #include <iostream.h>
> #include <limits.h>
> using namespace std;
>
> int main()
> {
> cout << endl
> << "The range for type short is from "
> << numeric_limits<short>::min()
> << " to "
> ...
>
> This program should be ANSI/ISO compliant and egcs is ANSI/ISO compliant.
> Right? So why doesn't it work??
Two things:
Egcs-1.1 implements lots of ANSI/ISO features, but it's "not there yet".
In particular, the libstdc++ library included is the old, backward-compatibility
version. The "v3" release (referred to as "all-singing, all-dancing") is
being worked on. To participate, see http://egcs.cygnus.com/libstdc++-v3.html .
Second, this program is not compliant. There is no standard header <iostream.h>,
(the standard one is <iostream>) and <limits.h> does not define the numeric_limits
template; that's in <limits>.
Nathan Myers
ncm@cygnus.com