Skip to content

Conversation

RealDeuce
Copy link

Since unix implies POSIX, and even POSIX.1 included uname(3), we can simply ask a POSIX system what the system name is.

While some compilers don't define unix for some platforms (ie: clang on macOS), it appears that every platform that defines unix at least has the POSIX unistd.h header.

Since __unix__ implies POSIX, and even POSIX.1 included uname(3),
we can simply ask a POSIX system what the system name is.

While some compilers don't define __unix__ for some platforms
(ie: clang on macOS), it appears that every platform that defines
__unix__ at least has the POSIX unistd.h header.
@RealDeuce
Copy link
Author

RealDeuce commented Mar 13, 2024

The __APPLE__ and __linux__ blocks could alse be switched to using uname, and the test for unistd.h could be expanded to #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) (as mentioned here), but there's presumably value in stable strings for the common targets (presumably, macOS returns "macOS" not "OS X" now for example).

Despite the test no longer running, the return value was still checked
by the test script.
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.

1 participant