I have a little VM for a programming language implemented in C. It supports being compiled under both 32-bit and 64-bit architectures as well as both C and C++.
I\'m try
Here are a few things I do. Not sure they're for everyone but they work for me.
int
or unsigned int
directly. There always seems to be a more appropriately named type for the job.uint32_t
).uint_fast16_t
), selecting the type based on the minimum size required to access all array elements. For example, if I have a for
loop that will iterate through 24 elements max, I'll use uint_fast8_t
and let the compiler (or stdint.h, depending how pedantic we want to get) decide which is the fastest type for that operation.If you disagree with any of those or have recommended alternatives please let me know in the comments! That's the life of a software developer... we keep learning or we become irrelevant.