This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: num_get<>::do_get (overflow/underflow - question)


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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]