whats the #ifdef whatever for linux?

Apr 22, 2010 at 10:10pm
If you only wanna make something defined under windows you use #ifdef _WIN32. What would you use for linux?
Apr 22, 2010 at 10:51pm
iirc it's __unix__

There's a page with tons of compiler and platform #defines. I have the link at home, but I'm at work right now =(

I'll reply later if nobody else chimes in.
Apr 22, 2010 at 11:03pm
ok thanks I would appreciate the list
Apr 22, 2010 at 11:49pm
Apr 23, 2010 at 2:57am
That's the one.

Thanks Bazzy
Apr 23, 2010 at 5:32am
Most Linux systems are POSIX complaint (Portable Operating System Inteface for UNIX).

They also (normally) define _POSIX_SOURCE; _POSIX_C_SOURCE >= 200112.
When using some of the latest functions from <unistd.h> or other header you may want to check the version first.

Also you could check the _XOPEN_SOURCE >= 600 macro when using the XSI (X/Open System Interface) features.
For example, before using the XSI strdup() function you may want to ensure that your implementation supports it.

Any values lower than that would probably mean compliance to outdated or older standards.

There are more macros depending on the features your implementation of UNIX/Linux supports.
The best way is to check the standard itself.

But __unix__ or __unix is good enough for basic purposes.
Last edited on Apr 23, 2010 at 5:40am
Topic archived. No new replies allowed.