Article View: gnu.g++.lib.bug
Article #76sign bug in stream.C: itoa
From: Doug Moore
Date: Tue, 14 Apr 1992 03:16
Date: Tue, 14 Apr 1992 03:16
33 lines
1123 bytes
1123 bytes
(previous posted inadvertantly to bug-g++)
The use of the itoa function in stream.C, as via dec(), places the minus
sign for negative numbers after the number, rather than before it.
The following patch fixes the problem.
Doug Moore (dougm@cs.rice.edu)
*** stream.C~ Mon Apr 13 21:08:54 1992
--- stream.C Mon Apr 13 21:18:20 1992
***************
*** 44,51 ****
if (needed < (2+neg) || ptr > EndBuffer)
return NULL;
*--ptr = 0;
- if (neg)
- *--ptr = '-';
if (i == 0)
*--ptr = '0';
--- 44,49 ----
***************
*** 58,63 ****
--- 56,63 ----
ch += '0';
*--ptr = ch;
}
+ if (neg)
+ *--ptr = '-';
if (size == 0)
return ptr;
while (ptr > buf)
Technical Details
Message-ID:
<9204140316.AA11831@cs.rice.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cs.rice.edu!dougmShow Full Headers
Complete Article Headers
Newsgroups: gnu.g++.lib.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cs.rice.edu!dougm From: dougm@cs.rice.edu (Doug Moore) Subject: sign bug in stream.C: itoa Message-ID: <9204140316.AA11831@cs.rice.edu> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Tue, 14 Apr 1992 03:16:35 GMT Approved: bug-lib-g++@prep.ai.mit.edu Lines: 37