simavr
simavr copied to clipboard
Check if environment is MinGW and implement missing strsep()
Fix for #403
Some implementations of string.h might not come come with strsep() as its not standard.
I can´t guarantee that the different string.h implementations will have defines for their methods, hence this is not universal solution,
Closed until I find a proper solution.
FWIW, glibc does not define strsep
, nor any other macro that would clearly imply that strsep()
is implemented.
Yes, my bad for not checking, usually libs come with the macros. Another possibility is to check for compiler.
#ifdef __clang__
/*code specific to clang compiler*/
#elif __GNUC__
/*code for GNU C compiler */
#elif _MSC_VER
/*usually has the version number in _MSC_VER*/
/*code specific to MSVC compiler*/
#elif __BORLANDC__
/*code specific to borland compilers*/
#elif __MINGW32__
/*code specific to mingw compilers*/
#endif
Do you guys have any objection about replacing #ifdef __MINGW32__
with #ifdef _WIN32
? looks like clang will have the same issue https://github.com/llvm-mirror/libcxx/blob/master/include/string.h and probably MSVC too.
Quite frankly I don't think why we'd bother with "32" bits versions of M$ OSes.. isn't there something more posixy to use on windows these days, like that Linux Subsystem for Windows?
The macros __MINGW32__
and _WIN32
are defined by compilers for 32-bit and 64-bit.
isn't there something more posixy to use on windows these days, like that Linux Subsystem for Windows?
Isn´t that MinGW?