c++ - Different data type lengths in third party libraries -


both c , c++ standards not specify exact length of data types, minimum lengths.

i have third party library: somelib.lib (compiled platform) , corresponding somelib.h. let's contains following functions:

int getnumber(); void setnumber(int number); 

when compile program consuming library, compiler checks types signatures defined in somelib.h, long use ints, should compile fine.

but happens when in compiler's int longer or shorter in compiler used compile somelib.lib? detected during linking? cause runtime errors? can safely use somelib.lib without knowing how compiled?

you should not compiler or linker errors, undefined behavior @ run-time. possibly crashes, or if you're lucky weird results.


Comments