This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: g++ unsigned warning
- From: Neil Booth <neil at daikokuya dot demon dot co dot uk>
- To: Benjamin Kosnik <bkoz at redhat dot com>
- Cc: gcc-bugs at gcc dot gnu dot org, jason at redhat dot com
- Date: Mon, 26 Nov 2001 07:44:03 +0000
- Subject: Re: g++ unsigned warning
- References: <Pine.SOL.3.91.1011125225002.6340B-100000@taarna.cygnus.com>
[Get raw message]
Benjamin Kosnik wrote:-
> on x86/linux with current:
>
> unsigned long ul1 = 4294967294;
>
> unsigned.cc:1: warning: decimal constant is so large that it is unsigned
>
> other platforms with:
>
> #include <limits>
> unsigned long ul1 = std::numeric_limits<unsigned long>::max();
>
>
> ?? What's the deal? It already is unsigned.
Decimal integer constants are signed by default, unless they're "big".
That's the warning you're getting. Maybe define your constant in hex.
Neil.