Next: Using #ifdef to Up: Conditional selection of Previous: Conditional selection of

Using #ifdef for Different Computer Types

Conditional selection is rarely performed using #defined values. A simple application using machine dependent values is illustrated below.


#include <stdio.h>

main()
{
#ifdef vax
      printf("This is a VAX\n");
#endif
#ifdef sun
      printf("This is a SUN\n");
#endif
}

sun is defined automatically on SUN computers. vax is defined automatically on VAX computers.


January 1995