This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Warnings on long constants in gcc 3.3, 3.4


test.c:7: warning: integer constant is too large for "long" type

for things like this:

#define LONGLONGMACRO 1099511628211
printf("%lld\n", LONGLONGMACRO);

While I could append "LL" to the constant (with apparently some
portability problems for the MSVC compiler, argh), it has been stated to
me that c99 should promote the type of the constant to something that it
will fit into.

Add -std=c99 (or -std=gnu99) and the warning is gone.



Segher



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]