This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Preprocessor variable for detecting platform
- From: "EXT-Pennington, Dale K" <dale dot k dot pennington at boeing dot com>
- To: <gcc-help at gcc dot gnu dot org>
- Date: Thu, 5 Mar 2009 09:26:43 -0600
- Subject: Preprocessor variable for detecting platform
I am producing some multiple platform code which does have some platform
dependent items that I would like to conditionally compile in. The
question is, how do I determine what the appropriate preprocessor
variable that would indicate for example, being on a Linux platform vs
an AIX platform.
For example there are some socket options that are platform specific, so
I would like to have code that looks like :
#if defined(_AIX_)
int option = TCP_NODELAYACK;
#else if defined(_LINUX_)
int option = TCP_QUICKACK;
#else
#error Unsupported platform, please determine proper option and update
code.
#endif
Thanks,
Dale Pennington