sheredom / utf8.h

📚 single header utf8 string functions for C and C++
The Unlicense
1.71k stars 122 forks source link

conflicting int32_t definition #38

Closed braddabug closed 7 years ago

braddabug commented 7 years ago

uint8.h detects _MSC_VER and #defines int32_t. The problem is that I've got another header that uses int32_t in a typedef, which ends up creating this:

typedef int32 int32;

which gives me a compiler error. Since stdint.h is included in Visual Studio 2010 and up, I propose changing the check for _MSC_VER to something like this:

#if (_MSC_VER < 1600)
#define int32_t __int32
#define uint32_t __uint32
#else
#include <stdint.h>
#endif

That way if we have stdint.h with visual studio we don't have to resort to #defines.

sheredom commented 7 years ago

Good catch, I'll work something up 😄

braddabug commented 7 years ago

Wups, I guess that should be something more like

#if defined(_MSC_VER) && _MSC_VER < 1600

to be compatible with non-Visual C++ compilers.

sheredom commented 7 years ago

Fixed in https://github.com/sheredom/utf8.h/pull/39