HP C/iX Reference Manual (31506-90011)
110 Chapter7
Preprocessing Directives
Line Control
Line Control
You can cause the compiler to increment line numbers during compilation from a number
specified in a line control directive. (The resulting line numbers appear in error message
references, but do not alter the line numbers of the actual source code.)
Syntax
line-directive
:=
#line
digit-sequence [filename]
Description
The #line preprocessing directive causes the compiler to treat lines following it in the
program as if the name of the source file were filename and the current line number is
digit-sequence. This is to control the file name and line number that is given in diagnostic
messages, for example. This feature is used primarily for preprocessor programs that
generate C code. It enables them to force the compiler to produce diagnostic messages with
respect to the source code that is input to the preprocessor rather than the C source code
that is output and subsequently input to the compiler.
The compiler defines two macros that you can use for error diagnostics. The first is , an
integer constant equal to the value of the current line number. The second is , a quoted
string literal equal to the name of the input source file. Note that you can change and
using #include or #line directives.
Example
#line
digit-sequence [filename]
: #line 5 "myfile"