Operating System - HP-UX
1826097 Members
4833 Online
109690 Solutions
New Discussion

#ifdef parameter for OS version

 
SOLVED
Go to solution
Vitek Pepas
Valued Contributor

#ifdef parameter for OS version

I can write OS dependent code using '#ifdef __hpux'. Is there a way to make the code depent on the version of the HP-UX (10.20 vs 11)?
1 REPLY 1
Mike Stroyan
Honored Contributor
Solution

Re: #ifdef parameter for OS version

There is no predefined macro for the OS version. You could define your own macro in a makefile. Something like -DOSRELEASE=$(uname -r) might work.

I prefer to test for a header file macro specific to some new feature I want to use. That makes the connection between the ifdef and the feature much more direct.
Here is an example-

#include
...
#ifdef PST_N_PG_SIZES /* only on 11.0 and later */
printf("pst_pagesize_hint: %lld\n",(long long) pst.pst_pagesize_hint);
#endif /* PST_N_PG_SIZES */