🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.lib.bug
Article #420

Bug in libg++-2.3 (using setfill/setw in iomanip).

#420
From: Lack Mr G M
Date: Tue, 05 Jan 1993 17:22
41 lines
1804 bytes
     I  have  just  built  libg++-2.3  on both a Sun SparcStation (SunOS
4.1.1) and an SG Indigo (Irix 4.0.1) using gcc-2.3.3 and have discovered
what I think is a bug in the newly-added manipulators in iomanip.h. 

     To  test the setw/setfill I used trivial example from 3/4 down p348
of Stroustrup's "The C++ Programming Language" Second Edition  (this  is
in section 10.4.2.1).  Here is the entire code... 

==============================  Test Source  ===========================
#include <iostream.h>
#include <iomanip.h>

int main()
{
   cout << setw(4) << setfill('#') << '(' << 12 << ")\n";
   cout << '(' << 12 << ")\n";
   return 0;
}
============================  End Test Source  =========================

  The output expected is:

(##12)
(12)

     but I get

###(12)
(12)

     from which I infer that the setw(4) and setfill('#') are being used
for the output of '('.  In 10.4.1.2 Stroustrup that these specifications
should apply to the "next numeric or string" output operation.  '(' is a
char and so shouldn't be affected. 

NOTE:  AT&T's cfront 2.1 agrees with Stroustrup on this.  I checked...


-------------------------- Gordon Lack ----------------------------------
The contents of this message *may* reflect my personal opinion.  They are
*not* intended to reflect those of my employer, or anyone else.
Technical Details
Message-ID: <9301051722.AA09942@uk0x06.ggr.co.uk>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!ggr.co.UK!gml4410

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.lib.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!ggr.co.UK!gml4410
From: gml4410@ggr.co.UK (Lack Mr G M)
Subject: Bug in libg++-2.3 (using setfill/setw in iomanip).
Message-ID: <9301051722.AA09942@uk0x06.ggr.co.uk>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Tue, 5 Jan 1993 17:22:29 GMT
Approved: bug-lib-g++@prep.ai.mit.edu
Lines: 42