#
.
#elif
, #else
.
#define
.
whitespace.
#undef
.
#ifdef
, #ifndef.
Conditional compilation.
assert
.
#include
.
##
.
#
.
.
E.2 (See below.)
1 // exE_02.cpp
2 // Self-Review Exercise E.2 solution.
3 #include <iostream>
4 using namespace std;
5
6 int main() {
7 cout << "__LINE__ = " << __LINE__ << endl
8 << "__FILE__ = " << __FILE__ << endl
9 << "__DATE__ = " << __DATE__ << endl
10 << "__TIME__ = " << __TIME__ << endl
11 << "__cplusplus = " << __cplusplus << endl;
12 } // end main
__LINE__ = 9
__FILE__ = c:cpp4ech19ex19_02.CPP
__DATE__ = Jul 17 2002
__TIME__ = 09:55:58
__cplusplus = 199711L
#define YES 1
#define NO 0
#include "common.h"
#if defined(TRUE)
#undef TRUE
#define TRUE 1
#endif
#ifdef TRUE
#undef TRUE
#define TRUE 1
#endif
#if ACTIVE
#define INACTIVE 0
#else
#define INACTIVE 1
#endif
#define CUBE_VOLUME(x) ((x) * (x) * (x))