showpos modifier and unsigned integers
Dirk Jagdmann
jagdmann@gmail.com
Wed Dec 22 07:05:00 GMT 2004
Hello,
I'm not sure if the followin is the correct and intended output
(according to standard). Given this simple program:
#include <iostream>
int main()
{
std::cout << std::showpos
<< (unsigned)+1 << std::endl
<< (signed)+1 << std::endl;
return 0;
}
The output is:
1
+1
I've ran this with g++ 3.4.2 on x86. For unsigned integers the showpos
modifier is ignored. But as unsigned integers are always positive
integers I'd like to see them prefixed with '+'.
Now I wonder: is g++ behaviour correct, thus does the standard say,
that for unsigned ints nothing is prefixed?
--
---> Dirk Jagdmann
----> http://cubic.org/~doj
-----> http://llg.cubic.org
More information about the Libstdc++
mailing list