Monday, March 14, 2016

C++ on windows and linux

Once I've encounted with problem - size of some variable on linux x86-64 differs from size of same variable on windows x86-64. And some years after that I couldn't remember - was it int or long or what. So here are link about it.
backuped article:
and here are another angry post about same problem)
backuped post:

So, problem in 'long' data type.

earlier I've used special macros to get DWORD == 4 bytes on x86 windows, x86-64 windows, x86 linux & x86-64 linux:
#if defined ( _MSC_VER )
    typedef unsigned long DWORD;
#else // for g++
    typedef unsigned int DWORD;

but now I would prefer _int32_t

1 comment: