long long not longer than long?

I had always thought that a long long variable was longer than a long. But when I come to use it with a 5 byte value I get an error.

 long long tags[] = { 0x3600789987, 0x3600789BB5 }; // define an array with two tags in it
 void setup(){
   Serial.begin(9600);
 }
 void loop(){
 }

Gives

This report would have more information with "Show verbose output during compilation" enabled in File > Preferences. Arduino: 1.0.5 (Mac OS X), Board: "Arduino Uno" sketch_jul24b:1: error: integer constant is too large for 'long' type sketch_jul24b:1: error: integer constant is too large for 'long' type

Is it just the effect the hot weather is having on me ( UK people will know ) or is there another way of defining it. I tried using unsigned long long and unsigned long long int with the same results.

Try putting LL after the constants…

long long tags = { 0x3600789987LL, 0x3600789BB5LL }; // define an array with two tags in it

I was gonna post that but the baby started crying. Lower case ll works too.

Grumpy_Mike: Is it just the effect the hot weather is having on me ( UK people will know )...

We've been beating record low temperatures (followed a few days later by brutal high temperatures). It's like riding a yo-yo.

Grumpy_Mike: I had always thought that a long long variable was longer than a long.

Oh, aye. Try long long long.

void setup ()
  {
  long long long foo;
  }  // end of setup

void loop () { }
sketch_jul24c.ino: In function 'void setup()':
sketch_jul24c:4: error: 'long long long' is too long for GCC

Then try:

void setup ()
  {
  long long long long long foo;
  }  // end of setup

void loop () { }

Thanks guys, it is what comes of trying to do something at 3:30 in the morning.

The big clue I missed was that the error message said:-

sketch_jul24b:1: error: integer constant is too large for 'long' type sketch_jul24b:1: error: integer constant is too large for 'long' type

In other words it was complaining twice which meant it came from the constants not the type definition.

So just like Sandy Denny once sang " It will take a long long time" and I never knew she was singing about the C compiler.

G-M: While you can use lower case "l" for the data specifier, six months from now you'll appreciate using upper case "L", especially when looking at the code at 3AM and not seeing what might look like a 1's digit.

I suspect given the snippet of code programmed using hex constants, that you probably want to use unsigned long long instead of long long, and for the constants you want to use a ULL suffix (you could also use ull, but as econjack says, it can be hard to tell a one from a lower case l).

Thanks, in fact I only ever need five bytes, it is for an RFID tag so there is no need for unsigned long long. Cheers

Grumpy_Mike: So just like Sandy Denny once sang " It will take a long long time" and I never knew she was singing about the C compiler.

Another Fairport Convention fan? I doubt if she knew she was singing about the C compiler either. :)