This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: showpos modifier and unsigned integers


On Wed, Dec 22, 2004 at 08:05:00AM +0100, Dirk Jagdmann wrote:

> 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 '+'.

See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15565

> Now I wonder: is g++ behaviour correct, thus does the standard say,
> that for unsigned ints nothing is prefixed?

jon

-- 
"Reason and free inquiry are the effectual agents against error.
 They are the natural enemies of error and error only."
	- Thomas Jefferson


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]