473,390 Members | 981 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,390 software developers and data experts.

warning: use of C99 long long integer constant

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
Apr 1 '08 #1
21 8320
On Apr 1, 8:39 am, Sebastian Faust <sebastian.fa...@googlemail.com>
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}

Regards and thanks a lot,
Sebastian
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
Apr 1 '08 #2
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.

Philip
Apr 1 '08 #3
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
Apr 1 '08 #4
Hi,

Btw. is there a possibility to get rid of this warning with some sort
of typecast?

Regards,
Sebastian

On 1 Apr., 15:03, Philip Potter <p...@doc.ic.ac.ukwrote:
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.

Philip
Apr 1 '08 #5
Hey guys,

Could you please tell me if there is any way to get rid of this
warning by applying some typecast?

Cheers,
Sebastian

On 1 Apr., 14:39, Sebastian Faust <sebastian.fa...@googlemail.com>
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}

Regards and thanks a lot,
Sebastian


Apr 1 '08 #6
[Top-posting corrected]
Sebastian Faust <se*************@googlemail.comwrites:
On 1 Apr., 15:03, Philip Potter <p...@doc.ic.ac.ukwrote:
>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.
<snip>
Btw. is there a possibility to get rid of this warning with some sort
of typecast?
Did you read my message? Was that not the problem?

--
Ben.
Apr 1 '08 #7
On 1 Apr., 16:16, Ben Bacarisse <ben.use...@bsb.me.ukwrote:
[Top-posting corrected]

Sebastian Faust <sebastian.fa...@googlemail.comwrites:
On 1 Apr., 15:03, Philip Potter <p...@doc.ic.ac.ukwrote:
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.
<snip>
Btw. is there a possibility to get rid of this warning with some sort
of typecast?

Did you read my message? Was that not the problem?

--
Ben.
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
Apr 1 '08 #8
Sebastian Faust <se*************@googlemail.comwrites:
On 1 Apr., 16:16, Ben Bacarisse <ben.use...@bsb.me.ukwrote:
>Sebastian Faust <sebastian.fa...@googlemail.comwrites:
On 1 Apr., 15:03, Philip Potter <p...@doc.ic.ac.ukwrote:
Sebastian Faust wrote:
<snip>
Unfortunately, I don't find lots of information on this
warning.
<snip>
The following code produces the warning:
const static unsigned long long data[1] = {
0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL}
<snip>
>Did you read my message? Was that not the problem?

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

--
Ben.
Apr 1 '08 #9
On 1 Apr., 16:30, Ben Bacarisse <ben.use...@bsb.me.ukwrote:
Sebastian Faust <sebastian.fa...@googlemail.comwrites:
On 1 Apr., 16:16, Ben Bacarisse <ben.use...@bsb.me.ukwrote:
Sebastian Faust <sebastian.fa...@googlemail.comwrites:
On 1 Apr., 15:03, Philip Potter <p...@doc.ic.ac.ukwrote:
Sebastian Faust wrote:
<snip>
Unfortunately, I don't find lots of information on this
warning.
<snip>
The following code produces the warning:
const static unsigned long long data[1] = {
0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL}
<snip>
Did you read my message? Was that not the problem?
--
Ben.

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

Ah, then you are in trouble, since you are compiling C99 with a
compiler that is expecting something else.
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
Apr 1 '08 #10
Sebastian Faust <se*************@googlemail.comwrites:
<snip lots but the code is:>

const static unsigned long long data[] = {
0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL
};
On 1 Apr., 16:30, Ben Bacarisse <ben.use...@bsb.me.ukwrote:
>Ah, then you are in trouble, since you are compiling C99 with a
compiler that is expecting something else.
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.
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.

--
Ben.
Apr 1 '08 #11
Martin Ambuhl said:

<snip>
The largest
integer you can use in C90 (or C89) is ULONG_MAX which is only
guaranteed to be at least 14294967295
s/1//

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Apr 1 '08 #12
On 1 Apr., 16:46, Ben Bacarisse <ben.use...@bsb.me.ukwrote:
Sebastian Faust <sebastian.fa...@googlemail.comwrites:

<snip lots but the code is:>

const static unsigned long long data[] = {
0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL

};
On 1 Apr., 16:30, Ben Bacarisse <ben.use...@bsb.me.ukwrote:
Ah, then you are in trouble, since you are compiling C99 with a
compiler that is expecting something else.
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.

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.
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?
Apr 1 '08 #13
Sebastian Faust wrote:
On 1 Apr., 16:46, Ben Bacarisse <ben.use...@bsb.me.ukwrote:
>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.
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?
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
Apr 1 '08 #14
"Sebastian Faust" <se*************@googlemail.comwrote in message
news:65**********************************@s19g2000 prg.googlegroups.com...
Could you please tell me if there is any way to get rid of this
warning by applying some typecast?
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

--
Stephen Sprunk "God does not play dice." --Albert Einstein
CCIE #3723 "God is an inveterate gambler, and He throws the
K5SSS dice at every possible opportunity." --Stephen Hawking

Apr 1 '08 #15
On 1 Apr., 17:43, Philip Potter <p...@doc.ic.ac.ukwrote:
Sebastian Faust wrote:
On 1 Apr., 16:46, Ben Bacarisse <ben.use...@bsb.me.ukwrote:
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.
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?

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?
It is a distributed development environment, and I don't wanna make
everyone to change his settings...
Apr 1 '08 #16
Sebastian Faust <se*************@googlemail.comwrites:
On 1 Apr., 17:43, Philip Potter <p...@doc.ic.ac.ukwrote:
>Sebastian Faust wrote:
On 1 Apr., 16:46, Ben Bacarisse <ben.use...@bsb.me.ukwrote:
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.
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?

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?
It is a distributed development environment, and I don't wanna make
everyone to change his settings...
<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.

--
Ben.
Apr 1 '08 #17
Hi Ben,

On 1 Apr., 20:05, Ben Bacarisse <ben.use...@bsb.me.ukwrote:
Sebastian Faust <sebastian.fa...@googlemail.comwrites:
On 1 Apr., 17:43, Philip Potter <p...@doc.ic.ac.ukwrote:
<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.
Thanks a lot for your answer! But again for this I have to change the
compiler flags what I did not want to do.
Apr 1 '08 #18
Sebastian Faust wrote:
On 1 Apr., 17:43, Philip Potter <p...@doc.ic.ac.ukwrote:
>Sebastian Faust wrote:
>>On 1 Apr., 16:46, Ben Bacarisse <ben.use...@bsb.me.ukwrote:
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.
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?
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?
It is a distributed development environment, and I don't wanna make
everyone to change his settings...
You have two "proper" solutions:

1) Change the distributed development environment. It's broken if you
expect it to be able to handle long long.
2) Change your code to be C90 (ie no "long long"). If you need an
integer bigger than 2**32-1, implement your own bignum library.

I don't know how to change the source to avoid your warnings but still
use long long. Even if there were, it would be a hacky solution. The
whole point of -ansi -pedantic is that it isn't supposed to allow such
things.

Philip
Apr 1 '08 #19
Philip Potter wrote:
Martin Ambuhl wrote:
>... 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.

That's the largest integer you can /portably/ use in C90.
Nit: With the minor corrections:
"The largest integer you can use in C90 (or C89) is ULONG_MAX, which is
only guaranteed to be at least 4294967295, the largest value representable
in 32 bits."

Martin's statement appears to be correct.

--
Thad
Apr 2 '08 #20
Sebastian Faust <se*************@googlemail.comwrites:
On 1 Apr., 17:43, Philip Potter <p...@doc.ic.ac.ukwrote:
>Sebastian Faust wrote:
On 1 Apr., 16:46, Ben Bacarisse <ben.use...@bsb.me.ukwrote:
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.
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?

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?
It is a distributed development environment, and I don't wanna make
everyone to change his settings...
The settings you're currently using are wrong for the code you're
compiling. If you don't have a mechanism for correcting such errors,
you've got a serious problem.

--
Keith Thompson (The_Other_Keith) <ks***@mib.org>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Apr 2 '08 #21
Thad Smith wrote:
Philip Potter wrote:
>Martin Ambuhl wrote:
>>... 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.
That's the largest integer you can /portably/ use in C90.

Nit: With the minor corrections:
"The largest integer you can use in C90 (or C89) is ULONG_MAX, which is
only guaranteed to be at least 4294967295, the largest value representable
in 32 bits."

Martin's statement appears to be correct.
Whoops! I read his article as "the largest integer you can use is
14294967295" and completely missed the intermediate words in the sentence.
Apr 2 '08 #22

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Jeff Gilchrist | last post by:
I have tried searching the newsgroup along with the GCC site and could not find what I think is probably a simple solution. I am using a 64bit unsigned long long integer and can manipulate 64bits...
4
by: mimmo | last post by:
Hi! I should convert the accented letters of a string in the correspondent letters not accented. But when I compile with -Wall it give me: warning: multi-character character constant Do the...
29
by: SysSpider | last post by:
Hi again, This is my problem: when i try to compile the code that contains the function below, i get this: -- gcc:21: error: case label does not reduce to an integer constant gcc:24: error:...
6
by: fctk | last post by:
hello, i'm trying to compile this small program: int main(void) { unsigned long int max; max = 4000000000;
17
by: jithoosin | last post by:
Hi, Why is the code not getting compiled ? I am using SuSe linux. Is it becuase of that ? #include<stdio.h> int main() { long long i; i = LL 9876543219; printf("%ld\n", i);
10
by: krunalb | last post by:
Hi, I am trying to shift unsigned long long value by 64 bits and this is what i get #include <stdio.h> int main() { unsigned short shiftby= 64;
3
by: wolverine | last post by:
Hi, I compiled the following code int main() { long long a = 0x7ff0000000000000L; } I got error "test.cpp:3: error: integer constant is too large for
7
by: Jo Deni | last post by:
Folks, I'm a newbie here (and with C++). While executing a C++ program I'm getting the following message error: integer constant is too large for "long" type and here is the offending line...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.