Created on 2000-12-30.00:00:00 last changed 171 months ago
Rationale:
adjustfield, basefield, and floatfield are each multi-bit fields. It is possible to set multiple bits within each of those fields. (For example, dec and oct). These fields are used by locale facets. The LWG reviewed the way in which each of those three fields is used, and believes that in each case the behavior is well defined for any possible combination of bits. See for example Table 58, in [facet.num.put.virtuals], noting the requirement in paragraph 6 of that section.
Users are advised to use manipulators, or else use the two-argument version of setf, to avoid unexpected behavior.
The Effects clause for ios_base::setf(fmtflags fmtfl) says "Sets fmtfl in flags()". What happens if the user first calls ios_base::scientific and then calls ios_base::fixed or vice-versa? This is an issue for all of the conflicting flags, i.e. ios_base::left and ios_base::right or ios_base::dec, ios_base::hex and ios_base::oct.
I see three possible solutions:
Most existing implementations that I tried seem to conform to resolution #3, except that when using the iomanip manipulator hex or oct then that always overrides dec, but calling setf(ios_base::hex) doesn't.
There is a sort of related issue, which is that although the ios_base constructor says that each ios_base member has an indeterminate value after construction, all the existing implementations I tried explicitly set ios_base::dec.
History | |||
---|---|---|---|
Date | User | Action | Args |
2010-10-21 18:28:33 | admin | set | messages: + msg2119 |
2000-12-30 00:00:00 | admin | create |