Topic: ios::adjustfield


Author: huber@kazoo.cs.uiuc.edu (Jay Huber)
Date: 28 Feb 1995 18:05:43 GMT
Raw View
Did the default field adjustment change?  In the old days, you got
right alignment by default, so that:

  cout << setw(4) << setfill('0') << 1;

would print "0001".  There are examples of this in C++2PL, in
sections 10.4.1.2 Output Fields and 10.4.1.5 Field Adjustment.
This is how Cfront and others work, but MetroWerks Code Warrior 5
uses left as the default, and prints "1000" for this example.
P. J. Plauger's book, The Draft Standard C++ Library, seems to
indicate that Code Warrior is correct, but it isn't very clear.

My question is, what is the correct behavior of the above code?