I am trying to port some code over to a LPC2378 ARM-7 MCU that makes use of "long long" variables. I have not been getting any compiler errors over variables being declared as "long long" but when I try to compare or perform arithmetic operations on these variables I get the following error: "error: #41: expression must have arithmetic or pointer type"
Here is an example from my code:
int Compare(long long a, long long b) { if (a <= b) { return 1; } return 0; }
Any ideas on what I can do?
Thanks, Eric
Interesting. A compiler that doesn't have a long long int data type should just compile it as a long int data type, and all arithmetic should work, as long as you don't get numeric overflows.
Your function Compare compiles without errors.
How do you call it ?
Would a long int be considered a 64 bit data type, similar to a long long?
Here is an example of my function being called:
if (Compare(sessionTable[i].accessTime, t) && sessionTable[i].inUse == 0) {...}
Thanks for the replies! -Eric
No - 'long long' is distinct from 'long int'
They might happen to be the same size - you'll need to check in the appropriate compiler's Manual for confirmation...
And take a look at this: www.danlhenry.com/.../keil_code.png
Okay, thanks.
Here is how I call that function:
if (Compare(sessionTable[i].accessTime, t) && sessionTable[i].inUse == 0) { ... }
Where sessionTable.accessTime is a long long.
-Eric