I have several sketches that have been moved from a Nano and Mega to a Teensy 3.2. I've adopted the terminology intxx_t/uintxx_t to be sure it works on both boards. The value of xx can be 8, 16, 32, or 64.
For variables that iterate over arrays, you want to use the
size_t type, which is an unsigned type large enough to iterate over array indexes. On 64-bit systems,
int is typically 32-bits, and the 64-bit system may need to issue extra instructions to do 32-bit arithmetic in 64-bit values. While on a 32-bit system like Teensy, you can use
int or
unsigned, it is a useful habit to get into in case your platform of choice changes over the years.
If you need a signed variant, there is
ssize_t, which is the same size as
size_t, but signed.
If you need integer types that are the same size as
void * pointers, there are the
intptr_t and
uintptr_t types. On most systems
void * is the same size as other object pointers, but there have been systems in the past that
void * was a different size or representation than
int *. And also, there have been systems where a pointer to a function is different than a pointer to an object.
If you want to use the largest integer type supported by the compiler, there are the
intmax_t and
uintmax_t types.
If you want a type that is at least
<n> bits, but is fast, you would want to use
int_fast<n>_t and
uint_fast<n>_t (replace
<n> with 8, 16, 32, or 64).
If you want a type that is at least
<n> bits, but may be larger, you would want to use
int_least<n>_t and
uint_least<n>_t (replace
<n> with 8, 16, 32, or 64).