c++ - Compiler Independent Types -
i've seen several libraries , c++ header files provide compiler independent types don't understand quite why compiler independent.
for example:
int number; // not compiler independent typedef unsigned int u32; u32 number2; // compiler independent
is above true? if so, why? don't quite understand why usage of typedef mean size of number2 same across compilers.
elaborating on comment,
proposition : use typedef compiler independence.
rationale : platform independence thing
implementation:
#ifdef _msc_ver #if _msc_ver < 1400 typedef int bar; #elif _msc_ver < 1600 typedef char bar; #else typedef bool bar; #else #error "unknown compiler" #endif
the preprocessor macro chain important part not typedef.
disclaimer: haven't compiled it!
Comments
Post a Comment