warning: use of C99 long long integer constant

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sebastian Faust

    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] = {
    0x428a2f98d728a e22ULL, 0x7137449123ef6 5cdULL}

    Regards and thanks a lot,
    Sebastian
  • Julienne Walker

    #2
    Re: warning: use of C99 long long integer constant

    On Apr 1, 8:39 am, Sebastian Faust <sebastian.fa.. .@googlemail.co m>
    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] = {
    0x428a2f98d728a e22ULL, 0x7137449123ef6 5cdULL}
    >
    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

    Comment

    • Philip Potter

      #3
      Re: warning: use of C99 long long integer constant

      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] = {
      0x428a2f98d728a e22ULL, 0x7137449123ef6 5cdULL}
      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

      Comment

      • Sebastian Faust

        #4
        Re: warning: use of C99 long long integer constant

        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

        Comment

        • Sebastian Faust

          #5
          Re: warning: use of C99 long long integer constant

          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] = {
          0x428a2f98d728a e22ULL, 0x7137449123ef6 5cdULL}
          >
          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

          Comment

          • Sebastian Faust

            #6
            Re: warning: use of C99 long long integer constant

            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.co m>
            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] = {
            0x428a2f98d728a e22ULL, 0x7137449123ef6 5cdULL}
            >
            Regards and thanks a lot,
            Sebastian


            Comment

            • Ben Bacarisse

              #7
              Re: warning: use of C99 long long integer constant

              [Top-posting corrected]
              Sebastian Faust <sebastian.faus t@googlemail.co mwrites:
              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] = {
              0x428a2f98d728a e22ULL, 0x7137449123ef6 5cdULL}
              >>
              >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.

              Comment

              • Sebastian Faust

                #8
                Re: warning: use of C99 long long integer constant

                On 1 Apr., 16:16, Ben Bacarisse <ben.use...@bsb .me.ukwrote:
                [Top-posting corrected]
                >
                >
                >
                Sebastian Faust <sebastian.fa.. .@googlemail.co mwrites:
                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] = {
                0x428a2f98d728a e22ULL, 0x7137449123ef6 5cdULL}
                >
                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

                Comment

                • Ben Bacarisse

                  #9
                  Re: warning: use of C99 long long integer constant

                  Sebastian Faust <sebastian.faus t@googlemail.co mwrites:
                  On 1 Apr., 16:16, Ben Bacarisse <ben.use...@bsb .me.ukwrote:
                  >Sebastian Faust <sebastian.fa.. .@googlemail.co mwrites:
                  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] = {
                  0x428a2f98d728a e22ULL, 0x7137449123ef6 5cdULL}
                  <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.

                  Comment

                  • Sebastian Faust

                    #10
                    Re: warning: use of C99 long long integer constant

                    On 1 Apr., 16:30, Ben Bacarisse <ben.use...@bsb .me.ukwrote:
                    Sebastian Faust <sebastian.fa.. .@googlemail.co mwrites:
                    On 1 Apr., 16:16, Ben Bacarisse <ben.use...@bsb .me.ukwrote:
                    Sebastian Faust <sebastian.fa.. .@googlemail.co mwrites:
                    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] = {
                    0x428a2f98d728a e22ULL, 0x7137449123ef6 5cdULL}
                    <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

                    Comment

                    • Ben Bacarisse

                      #11
                      Re: warning: use of C99 long long integer constant

                      Sebastian Faust <sebastian.faus t@googlemail.co mwrites:
                      <snip lots but the code is:>

                      const static unsigned long long data[] = {
                      0x428a2f98d728a e22ULL, 0x7137449123ef6 5cdULL
                      };
                      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.

                      Comment

                      • Richard Heathfield

                        #12
                        Re: warning: use of C99 long long integer constant

                        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

                        Comment

                        • Sebastian Faust

                          #13
                          Re: warning: use of C99 long long integer constant

                          On 1 Apr., 16:46, Ben Bacarisse <ben.use...@bsb .me.ukwrote:
                          Sebastian Faust <sebastian.fa.. .@googlemail.co mwrites:
                          >
                          <snip lots but the code is:>
                          >
                          const static unsigned long long data[] = {
                          0x428a2f98d728a e22ULL, 0x7137449123ef6 5cdULL
                          >
                          };
                          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?

                          Comment

                          • Philip Potter

                            #14
                            Re: warning: use of C99 long long integer constant

                            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

                            Comment

                            • Stephen Sprunk

                              #15
                              Re: warning: use of C99 long long integer constant

                              "Sebastian Faust" <sebastian.faus t@googlemail.co mwrote in message
                              news:65c0e85e-9ab2-47d0-9510-c10deb133c70@s1 9g2000prg.googl egroups.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

                              Comment

                              Working...