int i1 = 3, i2 = 3;

printf("Distance from macro : %d\n", distance1(i1,i2) )

;printf("Distance from inline function : %d\n", distance2(i1,i2) );

}

Predefined Macros

In addition to __LINE__ and __FILE__, HP aC++ provides the following predefined macros. The list describes the complete set of predefined macros that produce special information. They cannot be undefined nor changed.

__cplusplus produces the decimal constant 199707L, indicating that the implementation supports ANSI/ISO C++ International Standard features. For example,

#if (__cplusplus >= 199711L) #include

#else

#include

__DATE__ produces the date of compilation in the form Mmm dd yyyy.

__FILE__ produces the name of the file being compiled.

__HP_aCC identifies the HP aC++ compiler driver version. It is represented as a 6-digit number in the format mmnnxx, where mm is the major version number, nn is the minor version number, and xx is any extension. For example, for version A.01.21, __HP_aCC=012100.

__hpux is defined.

__ia64 is defined.

__LINE__ produces the current source line number.

__LP64__ is defined for +DD64.

_ILP32 is defined for +DD32.

_LP64 is defined for +DD64.

__STDCPP__ produces the decimal constant 1, indicating that the preprocessor is in ANSI C/C++ mode.

__TIME__ produces the time of compilation in the form hh:mm:ss.

__unix is defined.

To use some HP-UX system functions you may need to define the symbol __HPUX_SOURCE.

See stdsyms(5) manpage or the HP-UX Reference Manual for more information.

Assertions (#assert, #unassert)

Use #assert and #unassert to set a predicate name or predicate name and token to be tested with a #if directive. Note that you must also specify the -extoption at compile and link time.

Syntax

#assertpredicate-name[token-name]

#unassertpredicate-name[token-name]

Description

#assert sets the predicate-name [token-name] to true. #unassert sets the predicate-name [token-name] to false.

Note that when testing a predicate, it must be preceded by the # character.

Overview of the Preprocessor 125

Page 125
Image 125
HP C/aC++ for PA-RISC Software manual Assertions #assert, #unassert, Predefined Macros