This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: showpos modifier and unsigned integers
- From: Jonathan Wakely <cow at compsoc dot man dot ac dot uk>
- To: Dirk Jagdmann <jagdmann at gmail dot com>
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Wed, 22 Dec 2004 09:49:44 +0000
- Subject: Re: showpos modifier and unsigned integers
- References: <5d0f609904122123053c49a5b7@mail.gmail.com>
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