This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]