home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / gnu / g / lib / bug / 748 < prev    next >
Encoding:
Text File  |  1993-01-06  |  1.7 KB  |  55 lines

  1. Newsgroups: gnu.g++.lib.bug
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!ggr.co.UK!gml4410
  3. From: gml4410@ggr.co.UK (Lack Mr G M)
  4. Subject: Bug in libg++-2.3 (using setfill/setw in iomanip).
  5. Message-ID: <9301051722.AA09942@uk0x06.ggr.co.uk>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: GNUs Not Usenet
  8. Distribution: gnu
  9. Date: Tue, 5 Jan 1993 17:22:29 GMT
  10. Approved: bug-lib-g++@prep.ai.mit.edu
  11. Lines: 42
  12.  
  13.      I  have  just  built  libg++-2.3  on both a Sun SparcStation (SunOS
  14. 4.1.1) and an SG Indigo (Irix 4.0.1) using gcc-2.3.3 and have discovered
  15. what I think is a bug in the newly-added manipulators in iomanip.h. 
  16.  
  17.      To  test the setw/setfill I used trivial example from 3/4 down p348
  18. of Stroustrup's "The C++ Programming Language" Second Edition  (this  is
  19. in section 10.4.2.1).  Here is the entire code... 
  20.  
  21. ==============================  Test Source  ===========================
  22. #include <iostream.h>
  23. #include <iomanip.h>
  24.  
  25. int main()
  26. {
  27.    cout << setw(4) << setfill('#') << '(' << 12 << ")\n";
  28.    cout << '(' << 12 << ")\n";
  29.    return 0;
  30. }
  31. ============================  End Test Source  =========================
  32.  
  33.   The output expected is:
  34.  
  35. (##12)
  36. (12)
  37.  
  38.      but I get
  39.  
  40. ###(12)
  41. (12)
  42.  
  43.      from which I infer that the setw(4) and setfill('#') are being used
  44. for the output of '('.  In 10.4.1.2 Stroustrup that these specifications
  45. should apply to the "next numeric or string" output operation.  '(' is a
  46. char and so shouldn't be affected. 
  47.  
  48. NOTE:  AT&T's cfront 2.1 agrees with Stroustrup on this.  I checked...
  49.  
  50.  
  51. -------------------------- Gordon Lack ----------------------------------
  52. The contents of this message *may* reflect my personal opinion.  They are
  53. *not* intended to reflect those of my employer, or anyone else.
  54.  
  55.