Re: Compiler warning
- From: mattia <gervaz@xxxxxxxxx>
- Date: 31 Jul 2008 13:35:47 GMT
On Thu, 31 Jul 2008 12:26:02 +0000, Chris Torek wrote:
In article <4891adbd$0$41657$4fafbaef@xxxxxxxxxxxxxxxxxxx>, mattia
<gervaz@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?
You do not *have* to do anything, but your best bet is to write an
unsigned long constant, so that it is unsigned long in C99 as well:
unsigned long h = 2166136261UL;
The U suffix means "unsigned" and the L suffix means "long", and as with
declarations, the letters can appear in either order, but "UL" is more
conventional than "LU". (Unlike declarations, the letters can also be
either lowercase or uppercase, but lowercase L is too-often mistaken for
the digit 1, so stick with uppercase.)
Ok, thanks, but why the only way to display the number using printf is
printf("%lu\n", h)?
--
Mattia
.
- Follow-Ups:
- Re: Compiler warning
- From: Ben Bacarisse
- Re: Compiler warning
- References:
- Compiler warning
- From: mattia
- Re: Compiler warning
- From: Chris Torek
- Compiler warning
- Prev by Date: Re: stream io in c
- Next by Date: Re: Procyon Library for Atmel AVR MCU - I²C problems
- Previous by thread: Re: Compiler warning
- Next by thread: Re: Compiler warning
- Index(es):
Relevant Pages
|