Good question. On the compilers Rack uses,
long is 4 bytes (32 bits) on Windows x86_64 and 8 bytes (64 bits) on Mac/Linux x86_64.
Therefore you should never use the
long keyword, because there is no situation imaginable where you need an integer type that’s 4 bytes on Windows and 8 bytes on Mac/Linux (and if you do, you should be more explicit about this unusual requirement with
#if defined ARCH_WIN blocks).
If you care about the size of an integer type, use the explicit types in cstdint, e.g.
uint32_t, etc. If you don’t care about the size (if you know you only need to count to 1000 or so), use
int, which is 32-bit on all compilers Rack uses.
You will never see me use the keywords
unsigned in Rack code because they suggest that I do care about the type of an integer, in which case I should be using the cstdint types instead. It is better to forget those keywords exist.