Title
Wrong argument type of I/O stream manipulators setprecision() and setw()
Status
nad
Section
[iostream.format]
Submitter
Marc Steinbach

Created on 2009-06-20.00:00:00 last changed 172 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

  1. In [iostream.format], header <iomanip> synopsis change as indicated:

    T5 setprecision(intstreamsize n);
    T6 setw(intstreamsize n);
    
  2. In [std.manip], just before p. 6 change as indicated:

    unspecified setprecision(intstreamsize n);
    
  3. In [std.manip], just before p. 7 change as indicated:

    unspecified setw(intstreamsize n);
    
Date: 2010-10-21.18:28:33

[ 2009 Santa Cruz: ]

No concensus for this change. There was some interest in doing the opposite fix: Change the streamsize in <ios> to int. But ultimately there was no concensus for that change either.

Date: 2009-07-29.00:00:00

[ 2009-07-29 Daniel clarified wording. ]

Date: 2009-06-20.00:00:00

The header <iomanip> synopsis in [iostream.format] specifies

T5 setprecision(int n);
T6 setw(int n);

The argument types should be streamsize, as in class ios_base (see [ios.base]):

streamsize precision() const;
streamsize precision(streamsize prec);
streamsize width() const;
streamsize width(streamsize wide);

(Editorial: 'wide' should probably be renamed as 'width', or maybe just 'w'.)

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg917
2010-10-21 18:28:33adminsetmessages: + msg916
2010-10-21 18:28:33adminsetmessages: + msg915
2009-06-20 00:00:00admincreate