The current irrTypes.h defines s32 to be the following: typedef signed int s32; (on non windows systems) It is totally valid for a signed int to be 16 bits. In fact its range is specified in minimum range: signed int: -32767 to 32767 which is the same as a signed short. Generally this is not the case, however on certain embedded systems you cannot guarantee this. I propose the following solution. typedef int32_t s32; with a #include <cstdint>. However since Visual Studios compiler only added this C99 feature in 2010, keep the microsoft specific boiler plate. Now I think about it perhaps being standard compliant would be less portable then not standard compilant in which case you could do the following.
#ifdef (LONG_MAX == INT32_MAX)
typedef signed long s32;
#endif
#elif (INT_MAX == INT32_MAX)
typedef signed int s32;
#endif
#elif (SHORT_MAX == INT32_MAX)
typedef signed short s32;
#endif
#else
#error "Platform does not support 32 bit integers"
#endif
This last solution would be portable (assuming you had definitions for INT32_MAX available) it would be standard compilant and not add runtime cost, with almost no compiler overhead. Just a thought opinions are welcome.
We would need a configure script for this, otherwise it is problematic to check for existence of these additional includes. So yes, we could opt-in to add an include and a typedef based on the cstdint, but only if it is properly embraced by compile guards which are set elsewhere in system headers. Otherwise we have to add additional typedefs for those platforms using just 16bit integers (although I doubt that you will find any graphics capable system which is not 32bit). This is just reactive, but it avoids trouble with all those standard platforms out there.