Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if environment is MinGW and implement missing strsep() #404

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Mihaylov93
Copy link

Fix for #403

Some implementations of string.h might not come come with strsep() as its not standard.

@Mihaylov93
Copy link
Author

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.

@Mihaylov93 Mihaylov93 closed this Oct 3, 2020
@edgar-bonet
Copy link

FWIW, glibc does not define strsep, nor any other macro that would clearly imply that strsep() is implemented.

@Mihaylov93
Copy link
Author

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

@Mihaylov93 Mihaylov93 reopened this Oct 4, 2020
@Mihaylov93 Mihaylov93 changed the title Check if strsep() is not defined in the string.h included. Check if environment is MinGW and implement missing strsep() Oct 4, 2020
@Mihaylov93
Copy link
Author

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.

@buserror
Copy link
Owner

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?

@Mihaylov93
Copy link
Author

Mihaylov93 commented Oct 14, 2020

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants