is there a C macro or some kind of way that i can check if my c program was compiled as 64bit or 32bit at compile time in C?
Compiler: GCC Operating systems that i n
A compiler and platform neutral solution would be this:
// C
#include
// C++
#include
#if INTPTR_MAX == INT64_MAX
// 64-bit
#elif INTPTR_MAX == INT32_MAX
// 32-bit
#else
#error Unknown pointer size or missing size macros!
#endif
Avoid macros that start with one or more underscores. They are not standard and might be missing on your compiler/platform.