This is the mail archive of the
libstdc++@sourceware.cygnus.com
mailing list for the libstdc++ project.
Re: num_get<>::do_get (overflow/underflow - question)
- To: libstdc++@sourceware.cygnus.com
- Subject: Re: num_get<>::do_get (overflow/underflow - question)
- From: Ryszard Kabatek <rysio@rumcajs.chemie.uni-halle.de>
- Date: Mon, 3 May 1999 10:42:29 +0200 (CEST)
- Reply-To: kabatek@chemie.uni-halle.de
On Fri, 30 Apr 1999, Benjamin Kosnik wrote:
> What's cool is that istringstreams are now useful. Have you been using
> them? Do you think I should query libstdc++ to see if other people are
> trying to use them?
>
I compiled the current libstdc++ source last week.
On my machine the simple 'std::cout << "Hello, world!"' does not work.
The executable starts and... nothing occurs :_(
Prehaps the last egcs snapshot I used (egcs-1.1.2 does not compile the
library) has a bug?
> > Perhaps it would be better to check the variable 'errno' instead?
First I wanted to write 'too' instead of 'instead'.
>
> In addition. I still have to check __sanity.
>
> > Sample for int:
> >
> > errno = 0;
> > long __vl = strtol(__xtrc, 0, __base);
> > if (errno == 0
> > # if (INT_MAX) != (LONG_MAX)
> > && __vl >= INT_MIN && __vl <= INT_MAX
> > # endif
> > ) {
> > __v = static_cast<int>(__vl);
> > __err = ios_base::goodbit;
> > }
> > else
> > __err |= ios_base::failbit;
>
> If you can get away with it, no defines please. I'd rather you just check
> the returned value (_v) against INT_MIN and INT_MAX.
>
The reason for what I wrote this example was to get the faster solution
for 'int' on machines where sizeof(int) == sizeof(long).
Ryszard Kabatek
Martin-Luther University Halle-Wittenberg, Department of Physical Chemistry
Geusaer Str. 88, 06217 Merseburg, Germany
Tel. +49 3461 46 2487 Fax. +49 3461 46 2129