public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: Rainer Doerntge <doerntge@kiwilogic.com>
To: gcc-gnats@gcc.gnu.org
Subject: libstdc++/5424: ifstream::operator>>(int&) malfunction
Date: Fri, 18 Jan 2002 04:56:00 -0000	[thread overview]
Message-ID: <200201181247.g0IClUf31683@localhost.localdomain> (raw)


>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:


                 reply	other threads:[~2002-01-18 12:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200201181247.g0IClUf31683@localhost.localdomain \
    --to=doerntge@kiwilogic.com \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).