I am reading the Google Go tutorial and saw this in the constants section:
There are no constants like 0LL or 0x0UL
I tried to do a Google search but all that comes up are instances where people are using these constants but no explanation as to what they mean. 0x is supposed to start a hexadecimal literal but these are not characters that are possible in a hexadecimal number.
These are constants in C and C++. The suffix
LLmeans the constant is of typelong long, andULmeansunsigned long.In general, each
Lorlrepresents alongand eachUorurepresents anunsigned. So, e.g.means the constant 1 with type
unsigned long long.This also applies to floating point numbers:
and strings and characters, but they are prefixes:
In C and C++ the integer constants are evaluated using their original type, which can cause bugs due to integer overflow:
In Google Go, all integers are evaluated as big integers (no truncation happens),
and there is no “usual arithmetic promotion“
so the suffixes are not necessary.