Compiler Macros


Table of Contents

Compiler macros

You probably maybe possibly really want to use -std1 -isoc94 at all times maybe!

PreprocessorDescriptionCompiler flag
__DECCDEC C compiler.-std0
__DECC_VERDEC C compiler.-std0
__osf__The system is DEC OSF/1.(or -std -std0 -stf1)
__alphaThe platform is Alpha.(or -std -std0 -std1)
__STDC__Compiler conforms to an ISO C standard.-isoc94
__STDC_VERSION__The ISO C standard compiler comforms to.(or -std -std1) and -isoc94

For example, the following code requires the flags -std1 and -isoc94 to be passed to cc:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <stdio.h>

int
main(void)
{
#if defined(__DECC)
  printf("DEC C compiler\n");
#endif

#if defined(__DECC_VER)
  printf("Version %d\n", __DECC_VER);
#endif

#if defined(__alpha)
  printf("Alpha\n");
#endif

#if defined(__osf__)
  printf("DEC OSF/1\n");
#endif

#if defined(__STDC__)
# if defined(__STDC_VERSION__)
  printf("C Standard: %d\n", __STDC_VERSION__);
# endif
#endif

  return 0;
}
 
 
Return to top
 
Created: