Re: Compiler warning
- From: vippstar@xxxxxxxxx
- Date: Thu, 31 Jul 2008 05:24:24 -0700 (PDT)
On Jul 31, 3:19 pm, mattia <ger...@xxxxxxxxx> wrote:
Hi all, I've got to use this declaration:
unsigned long h = 2166136261;
but the gcc compiler warns me saying "warning: this decimal constant is
unsigned only in ISO C90".
What should I do?
unsigned long h = 2166136261UL;
should get rid of the warning.
What it means is that let's call your number x, x is greater than
LONG_MAX.
In C90, 'long' is the largest signed integer type. Since x cannot be
represented by long, but it can be represented by unsigned long, x
will be unsigned.
In C99, x can fit in 'long long', so in C99, x will be 'long long'.
'UL' specifies that it has to be unsigned long.
.
- References:
- Compiler warning
- From: mattia
- Compiler warning
- Prev by Date: Re: A basic question question about volatile use
- Next by Date: Re: stream io in c
- Previous by thread: Compiler warning
- Next by thread: Re: Compiler warning
- Index(es):
Relevant Pages
|