Re: Compiler warning



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



Relevant Pages

  • Compiler warning
    ... but the gcc compiler warns me saying "warning: this decimal constant is ... unsigned only in ISO C90". ...
    (comp.lang.c)
  • Re: sizeof a struct
    ... bytes.c:10: warning: bit-field `y' type invalid in ISO C ...
    (comp.lang.c)
  • Re: 5.2.1-RELEASE lib/libedit broken? Problems with tr(1) and LANG=de_DE.ISO8859-15
    ... fcns.h:18:23: warning: ISO C requires whitespace after the macro name ...
    (freebsd-current)
  • Re: Which PIC18 C Compiler?
    ... >> You will not get a fully ISO C compliant compiler for the PIC. ... You will have to compare the PIC compiler specs, along with C99 and C90 to be specific. ...
    (comp.arch.embedded)
  • Re: Debian packages without md5sums
    ... WARNING: This version of acpid is from an untrusted source! ... Reading package lists... ... In a separate respose Florian Kulzer pointed out that the ISO images ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
    (Debian-User)