I wonder why on MacOSX the macro __unix__
is not defined.
Isn't MacOSX a BSD UNIX derivative?
If I define the __unix__
macro in my code, could I have some issues?
In general, when checking the current platform, I prefer to do something like:
#ifdef __unix__
...
#endif
instead of:
#if defined(__unix__) || defined(__APPLE__) || defined(__linux__) || defined(BSD) ...
...
#endif
Could the best option be to define my own macro in a single place? E.g.:
#if defined(__unix__) || defined(__APPLE__) || defined(__linux__) || defined(BSD) ...
#define UNIX_
#endif
POSIX requires _POSIX_VERSION
to be defined in <unistd.h>
(also accessible via sysconf(_SC_VERSION)
), so try that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With