public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* libstdc++/5424: ifstream::operator>>(int&) malfunction
@ 2002-01-18  4:56 Rainer Doerntge
  0 siblings, 0 replies; only message in thread
From: Rainer Doerntge @ 2002-01-18  4:56 UTC (permalink / raw)
  To: gcc-gnats


>Number:         5424
>Category:       libstdc++
>Synopsis:       std::ifstream::operator>>(int&) fails with negative hex numbers
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 18 04:56:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        3.0.3
>Organization:
Kiwilogic.com AG
>Environment:
System: Linux klservedv 2.4.9-13smp #1 SMP Tue Oct 30 19:57:16 EST 2001 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../configure --enable-exceptions --enable-threads
>Description:
	Any negative int written to a file with std::ofstream::operator<<(int
	const&) and std::ios::hex as basefield is written in the
	complementary notation (-1 becomes ffffffff). When
	std::ifstream::operator>>(int&) tries to read that number
	again, the failbit gets set. This work finely under g++ < v3,
	Sun Forte C++, Borland's BCB5 and others.

>How-To-Repeat:
	Write -1 to an ofstream in hex basefield mode and
	try to read it in again in hex basefield mode using
	std::ifstream
>Fix:
	Read the number as string and convert it afterwards using
	e. g. atoi.
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-01-18 12:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-18  4:56 libstdc++/5424: ifstream::operator>>(int&) malfunction Rainer Doerntge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).