Warning: Use Of C99 Long Long Integer Constant | C Programming

Coding Forums
  • Forums New posts Search forums
  • Members Current visitors
Log in Register What's new Search

Search

Everywhere Threads This forum This thread Search titles only By: Search Advanced search…
  • New posts
  • Search forums
Menu Log in Register Install the app Install
  • Forums
  • Archive
  • Archive
  • C Programming
You are using an out of date browser. It may not display this or other websites correctly.You should upgrade or use an alternative browser. warning: use of C99 long long integer constant
  • Thread starter Sebastian Faust
  • Start date Apr 1, 2008
  • 1
  • 2
Next 1 of 2

Go to page

Go Next Last S

Sebastian Faust

Hi, Unfortunately, I don't find lots of information on this warning. It occurs if I compile with -pedantic but I am not sure how I can resolve this problem. Do you have an idea? The following code produces the warning: const static unsigned long long data[1] = { 0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL} Regards and thanks a lot, Sebastian B

Ben Bacarisse

Sebastian Faust said: Unfortunately, I don't find lots of information on this warning. It occurs if I compile with -pedantic but I am not sure how I can resolve this problem. Do you have an idea? The following code produces the warning: const static unsigned long long data[1] = { 0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL} Click to expand...
; /* <- missing */ Both long long and its associated constants are features of C99. You are probably not compiling in C99 mode, but instead are asking for the compiler to check your program against the older C90 standard. If you are using gcc (as seems probable), add -std=c99 to the command line. You will also be warned that you give an array length of 1 but include to elements in the initialization. J

Julienne Walker

Hi, Unfortunately, I don't find lots of information on this warning. It occurs if I compile with -pedantic but I am not sure how I can resolve this problem. Do you have an idea? The following code produces the warning: const static unsigned long long data[1] = { 0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL} Regards and thanks a lot, Sebastian Click to expand...
You neglected to post the warning. However, I'm surprised you don't get an error since you try to initialize an array of 1 with two values. -Jul P

Philip Potter

Sebastian said: Hi, Unfortunately, I don't find lots of information on this warning. It occurs if I compile with -pedantic but I am not sure how I can resolve this problem. Do you have an idea? The following code produces the warning: const static unsigned long long data[1] = { 0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL} Click to expand...
Aside from the warning (which Ben Bacarisse has explained), note that you are trying to initialize an array of size 1 with two members. Please quote the warning in the message as well as the subject. Philip S

Sebastian Faust

Hi, Thanks! it works! It was just a copy&paste typo... I copied the relevant code and then I made this typo... Thanks again, Sebastian S

Sebastian Faust

Hi, Btw. is there a possibility to get rid of this warning with some sort of typecast? Regards, Sebastian
Sebastian said: Hi, Click to expand...
Unfortunately, I don't find lots of information on this warning. It occurs if I compile with -pedantic but I am not sure how I can resolve this problem. Do you have an idea? Click to expand...
The following code produces the warning: const static unsigned long long data[1] = { 0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL} Click to expand...
Aside from the warning (which Ben Bacarisse has explained), note that you are trying to initialize an array of size 1 with two members. Please quote the warning in the message as well as the subject. Philip Click to expand...
S

Sebastian Faust

Hey guys, Could you please tell me if there is any way to get rid of this warning by applying some typecast? Cheers, Sebastian B

Ben Bacarisse

[Top-posting corrected]
Sebastian Faust said:
Sebastian said: Hi, Click to expand...
Unfortunately, I don't find lots of information on this warning. It occurs if I compile with -pedantic but I am not sure how I can resolve this problem. Do you have an idea? Click to expand...
The following code produces the warning: const static unsigned long long data[1] = { 0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL} Click to expand...
Aside from the warning (which Ben Bacarisse has explained), note that you are trying to initialize an array of size 1 with two members. Please quote the warning in the message as well as the subject. Click to expand...
Click to expand...
Btw. is there a possibility to get rid of this warning with some sort of typecast? Click to expand...
Did you read my message? Was that not the problem? S

Sebastian Faust

[Top-posting corrected]
Sebastian Faust said:
Sebastian Faust wrote: Hi, Unfortunately, I don't find lots of information on this warning. It occurs if I compile with -pedantic but I am not sure how I can resolve this problem. Do you have an idea? The following code produces the warning: const static unsigned long long data[1] = { 0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL} Aside from the warning (which Ben Bacarisse has explained), note that you are trying to initialize an array of size 1 with two members. Please quote the warning in the message as well as the subject. Click to expand...
Click to expand...
Btw. is there a possibility to get rid of this warning with some sort of typecast? Click to expand...
Did you read my message? Was that not the problem? Click to expand...
Yes that solved the problem, but I cannot change the option how the program is compiled. So, is there a way to change the sourcecode? Although I am not sure if this is actually a good approach... Cheers, Sebastian B

Ben Bacarisse

Sebastian Faust said:
Sebastian Faust said: Sebastian Faust wrote: Click to expand...
Unfortunately, I don't find lots of information on this warning. Click to expand...
The following code produces the warning: const static unsigned long long data[1] = { 0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL} Click to expand...
Click to expand...
Did you read my message? Was that not the problem? Click to expand...
Click to expand...
Best not to quote sigs.
Yes that solved the problem, but I cannot change the option how the program is compiled. So, is there a way to change the sourcecode? Although I am not sure if this is actually a good approach... Click to expand...
Ah, then you are in trouble, since you are compiling C99 with a compiler that is expecting something else. In such a situation I would not want to turn off the warnings. I'd want then all and I'd keep checking that none of them was indicating a more serious problem. S

Sebastian Faust

Sebastian Faust said:
Sebastian Faust wrote: Click to expand...
Unfortunately, I don't find lots of information on this warning. Click to expand...
The following code produces the warning: const static unsigned long long data[1] = { 0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL} Click to expand...
Did you read my message? Was that not the problem? Click to expand...
Click to expand...
Best not to quote sigs.
Yes that solved the problem, but I cannot change the option how the program is compiled. So, is there a way to change the sourcecode? Although I am not sure if this is actually a good approach... Click to expand...
Ah, then you are in trouble, since you are compiling C99 with a compiler that is expecting something else. Click to expand...
Ok! Thanks! Is there a way to solve these particular warnings (use of C99 long long...) with some change in the code? The reason for this is that there are hundreds of these warnings and I don't wanna frustrate the guy who has to compile the code. Cheers, Sebastian B

Ben Bacarisse

<snip lots but the code is:> const static unsigned long long data[] = { 0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL };
Ok! Thanks! Is there a way to solve these particular warnings (use of C99 long long...) with some change in the code? The reason for this is that there are hundreds of these warnings and I don't wanna frustrate the guy who has to compile the code. Click to expand...
Not that I know of. Try posting in a gcc group. The real problem is not the warning or the code but the fact that, for some reason, you are not allowed to tell the compiler what language it is seeing! That is not a sane restriction to put on a build system. The next release of your compiler may choose not to accept long long and its constants, and your code will just stop working. Your code compiles at the moment due to the good graces of your compiler -- as an extension it is allowing long long in C90 mode. This is not a safe way to proceed. M

Martin Ambuhl

Sebastian said: Hi, Unfortunately, I don't find lots of information on this warning. It occurs if I compile with -pedantic but I am not sure how I can resolve this problem. Do you have an idea? The following code produces the warning: const static unsigned long long data[1] = { 0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL} Click to expand...
The gcc-specific information below is actually off-topic here, but the distinction between which standards support what and the need your documentation to check for what your compiler supports and how to call it remains topical: The standards before C99, the ones used for the gcc compile flags -ansi or -std=c89 or -std=iso9899:1990 or -std=iso9899:199409, did not provide the integer types [signed|unsigned] long long [int]. The largest integer you can use in C90 (or C89) is ULONG_MAX which is only guaranteed to be at least 14294967295, equivalent to 32 bits. Your values require a 63 bit value at least (note that you don't touch the sign bit). If you insist on using those values, invoke gcc with the (equivalent) -std=c99 or -std=c9x or -std=9899:1999 or -std=9899:199x flags. P

Philip Potter

Martin said:
Sebastian said: The following code produces the warning: const static unsigned long long data[1] = { 0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL} Click to expand...
The standards before C99, the ones used for the gcc compile flags -ansi or -std=c89 or -std=iso9899:1990 or -std=iso9899:199409, did not provide the integer types [signed|unsigned] long long [int]. The largest integer you can use in C90 (or C89) is ULONG_MAX which is only guaranteed to be at least 14294967295, equivalent to 32 bits. Click to expand...
That's the largest integer you can /portably/ use in C90.
Your values require a 63 bit value at least (note that you don't touch the sign bit). Click to expand...
There is no sign bit; he's dealing with unsigned types only. S

Sebastian Faust

<snip lots but the code is:> const static unsigned long long data[] = { 0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL };
Ok! Thanks! Is there a way to solve these particular warnings (use of C99 long long...) with some change in the code? The reason for this is that there are hundreds of these warnings and I don't wanna frustrate the guy who has to compile the code. Click to expand...
Not that I know of. Try posting in a gcc group. The real problem is not the warning or the code but the fact that, for some reason, you are not allowed to tell the compiler what language it is seeing! That is not a sane restriction to put on a build system. The next release of your compiler may choose not to accept long long and its constants, and your code will just stop working. Your code compiles at the moment due to the good graces of your compiler -- as an extension it is allowing long long in C90 mode. This is not a safe way to proceed. Click to expand...
I know that in VC++ although it followed only the C90 standard there was a way for 64 bit integers with __int64. Is there something like this for gcc? P

Philip Potter

Sebastian said: I know that in VC++ although it followed only the C90 standard there was a way for 64 bit integers with __int64. Is there something like this for gcc? Click to expand...
This answer may seem unhelpful but the datatype you describe is called "long long". long long was in gcc before C99 standardized it. *Why* can't you change the options on your compiler? *Why* do you need a guaranteed 64-bit integer type? Philip S

Stephen Sprunk

Sebastian Faust said: Could you please tell me if there is any way to get rid of this warning by applying some typecast? Click to expand...
Typecasting is something done to actors. In C, you "cast" things. And no, you can't get rid of the warning with a cast because the problem is that you're trying to compile a C99 program with a C90 compiler. The solution is to upgrade or properly invoke your compiler in C99 mode. A cast is almost always the wrong solution to a problem. S S

Sebastian Faust

This answer may seem unhelpful but the datatype you describe is called "long long". long long was in gcc before C99 standardized it. *Why* can't you change the options on your compiler? *Why* do you need a guaranteed 64-bit integer type? Click to expand...
It is a distributed development environment, and I don't wanna make everyone to change his settings... B

Ben Bacarisse

Sebastian Faust said: It is a distributed development environment, and I don't wanna make everyone to change his settings... Click to expand...
<off topic now...> -Wno-long-long Seems to work with -pedantic and -std=c89, but I emphasize that this is probably not the right solution. S

Sebastian Faust

Hi Ben,
<off topic now...> -Wno-long-long Seems to work with -pedantic and -std=c89, but I emphasize that this is probably not the right solution. Click to expand...
Thanks a lot for your answer! But again for this I have to change the compiler flags what I did not want to do.
  • 1
  • 2
Next 1 of 2

Go to page

Go Next Last Post reply

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

big decimal integer constant warning 6 Mar 29, 2006
Size of Integer , long Integer, Long double 5 Jul 4, 2010
Why, warning: comparison between signed and unsigned integer expressions? 13 May 29, 2012
C99 float variants of math.h functions 6 Aug 2, 2009
C & ncurses problem *warning - long source 4 Jun 6, 2007
no warning for assigning unsigned int to plain int 5 Oct 12, 2011
promotion and narrowing integer conversion 14 Jan 21, 2010
'Needless flexibilities' and structured records [very long] 10 Mar 15, 2013
Share: Facebook Twitter Reddit Pinterest Tumblr WhatsApp Email Share Link

Members online

No members online now. Total: 921 (members: 0, guests: 921) Robots: 50

Forum statistics

Threads 474,033 Messages 2,570,346 Members 46,993 Latest member Madison79H

Latest Threads

  • Can any one solve this CS1Robots Module problem?
    • Started by kalibardapi212
    • Today at 6:01 AM
  • Are there any free methods available for repairing damaged Outlook PST files?
    • Started by Rajneesh22
    • Yesterday at 11:38 AM
  • How can I Repair Outlook PST file without any technical knowledge?
    • Started by Rajneesh22
    • Yesterday at 11:32 AM
  • Im just sharing my codes... V1.0 (Predevelop - AKA just intro)
    • Started by fatburb27coding
    • Yesterday at 10:39 AM
  • Trusted PST Converter Tool to Convert PST Into Multiple Format without Outlook!!
    • Started by justinchapman
    • Yesterday at 6:19 AM
  • Adobe Acrobat JavaScript PDF Script Issues: File Matching and Dynamic Retrieval
    • Started by sapedersen
    • Friday at 7:31 PM
  • Why we need to convert OST to PST?
    • Started by Rajneesh22
    • Friday at 7:26 AM
  • I am looking for a programmer for projects
    • Started by rnh55
    • Thursday at 8:58 PM
  • Can someone pls help me with a little algorithm script
    • Started by jsnoob
    • Thursday at 4:40 PM
  • How do I make my code output information about the students in the C# assignment:
    • Started by DJ_KrassiBoy
    • Thursday at 10:00 AM
  • Forums
  • Archive
  • Archive
  • C Programming
Top

Từ khóa » C99 Long