This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: libstdc++/5424: std::ifstream::operator>>(int&) fails with negative hex numbers


Synopsis: std::ifstream::operator>>(int&) fails with negative hex numbers

State-Changed-From-To: analyzed->closed
State-Changed-By: paolo
State-Changed-When: Sat Jan 19 14:10:28 2002
State-Changed-Why:
    In fact, the behaviour of libstdc++-v3 is strictly standard
    conforming. Indeed, according to 22.2.2.2.2, Table 57, the
    stdio equivalent of the conversion is %x, thus leading to
    ffffffd6 for -42 (i.e., equivalent to printf("%x", -42)).
    When the read is attempted it does *not* fit in a signed
    int i, and it fails. You can fix your code by using an
    unsigned int i.
    
    Cheers,
    Paolo.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5424


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