home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: gnu.g++.lib.bug
- Path: 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
-
- 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.
-
-