Compaq C/C++


[Home] Home > Programming > Preprocessor > Compilers >
Compaq

Description

The C and C++ compilers on Digital UNIX / Tru64, ULTRIX, and VMS.

The Ultrix C compiler is essentially the same as the BSD C compiler and thus has no version macro, you just look out for the ultrix macro.

Macros

Type Macro Format Flag(s) Description
Identification __DECC   (or -std -std0 -std1) C compiler
Version __DECC_VER VVRRTPPPP (or -std -std0 -std1) VV = Version
RR = Revision
T = Type (9 = official)
PPPP = Patch
Identification __DECCXX     C++ compiler
Version __DECCXX_VER As __DECC_VER    
Identification __VAXC     VAX C compiler
Identification VAXC     VAX C compiler
Identification VAX11C     System is a VAX-11 or newer

Examples

Version __DECC_VER
5.8-009 50890009
6.0-001 60090001

Notes

With OSF/1, you really want to be using the -std1 -isoc94 compiler flags at all times.

The -isoc94 compiler flag will make __STDC__ available, and the -std or -std1 flags will make __STDC_VERSION__ available.

On ULTRIX it will be worth including sys/ansi_compat.h too so that preprocessor symbols are on a par with those on OSF/1. I am not sure if they will be similar to those on VMS.

Example Code

#include <stdio.h>
#include <sys/ansi_compat.h>

int
main()
{
#if defined(__DECC)
    printf("DEC C compiler\n");
#elif defined(__DECCXX)
    printf("DEC C++ compiler\n");
#elif defined(__VAXC)
    printf("VAX C compiler\n");
#elif defined(__VAX11C)
    /* I'd assume this is for ULTRIX on the VAX-11. */
    printf("VAX-11 C compiler\n");
#else
# if defined(__ultrix)
    printf("ULTRIX C compiler\n");
# endif
#else
    printf("Unknown C compiler\n");
#endif
}

Copyright © 2010-2024 Paul Ward.
License Information