C/C++ Programmer's Guide (G06.27+, H06.03+)

Table Of Contents
Compiling, Binding, and Accelerating TNS C++
Programs
HP C/C++ Programmer’s Guide for NonStop Systems429301-010
15-4
Working in the Guardian Environment
Generation of #line Directives
Cprep generates #line directives indicating the original C++ source file, edit line
number, and timestamp. These #line directives appear in the output from Cprep and
are also propagated through to the output of Cfront. These #line directives are
generated to support source-level debugging and to support generation of error
messages from Cfront. The symbolic debuggers use the #line directive information to
map from object code to the corresponding location in the C++ source code.
The first time a file is referenced, the #line directive has the form:
#line edit-line-number "source-file-name timestamp"
For subsequent lines in that file, the #line directive has the form:
#line edit-line-number
The timestamp given the first time a file is referenced represents the modification
timestamp for the C++ source input file. This information is used by the symbolic
debuggers to identify possible source code version inconsistencies.
Cprep Run Command Syntax
To notify Cprep that it is processing a C++ program, you must specify
#define __cplusplus in the source file or define __cplusplus on the Cprep run
command line. Note that two underscore characters are required before the word
cplusplus.
Cprep creates an intermediate file to be used by Cfront. Cfront creates an intermediate
file to be used by the C compiler. Be sure to purge any existing intermediate files
before running Cprep. If you forget to delete an existing intermediate file, the output will
be appended to the end of that file.
You use this syntax to run Cprep:
IN source
specifies the name of the file that contains your original C++ source code.
OUT intermediate-file1
specifies the file to which Cprep writes its C++ source file. If you omit the OUT
option, the output goes to your current default output file, usually the terminal.
CPREP /IN source, OUT intermediate-file1 / define __cplusplus
[ , compile-option [ , compile-option ]...]
compile-option:
{ SSV-pragma }
{ pragma }
{ define identifier [ integer-constant ] }