next up previous contents index
Next: Variables and Functions Up: C++ Basics Previous: Comments   Contents   Index

Pre-Processing

The compiler ignores nearly all whitespace (spaces, tabs, and newlines), which should be used liberally to make files easy to read. Other punctuation (periods, commas, (semi)colons, parentheses, braces, and quotes) dictates file parsing, and must adhere stringently to grammar.

A C++ file consists of ``statements''. A statement ends with a semicolon, and conventionally a file contains one statement per line (when possible). For historical reasons, an input file is ``pre-processed'' before the compiler sees it. The most important use of pre-processing in ePiX is file inclusion. An ePiX file always begins with the lines

#include "epix.h" // N.B. pre-processor directive, no semicolon
using namespace ePiX;
The first line is analogous to a LATEX usepackage command: It causes the pre-processor to replace the line with the contants of a file, thereby importing the names of commands provided by ePiX. To avoid name conflicts, ePiX's commands are enclosed in a ``namespace''. For example, the label command is actually known to the compiler as ePiX::label. The second line above tells the compiler to apply the prefix tacitly.



Andrew D. Hwang 2004-09-04