In C99, I include stdint.h and that gives me UINT32_MAX as well as uint32_t data type. However, in C++ the UINT32_MAX gets defined out. I can define __STDC_LIMIT_MACROS before including stdint.h, but this does not work if someone is including my header after already including stdint.h themselves.
So in C++, what is the standard way of finding out the maximum value representable in a uint32_t?
Not sure about
uint32_t, but for fundamental types (bool,char,signed char,unsigned char,wchar_t,short,unsigned short,int,unsigned int,long,unsigned long,float,doubleandlong double) you can use thenumeric_limitstemplates via#include <limits>.If
uint32_tis a#defineof one of the above than this code should work out of the box