#line
Go Up to Preprocessor Directives Index
Syntax
#line integer_constant <"filename">
Description
You can use the #line directive to supply line numbers to a program for cross-reference and error reporting. If your program consists of sections derived from some other program file, it is often useful to mark such sections with the line numbers of the original source rather than the normal sequential line numbers derived from the composite program.
The #line directive indicates that the following source line originally came from line number integer_constant
of filename
. Once the file name has been registered, subsequent #line commands relating to that file can omit the explicit filename
argument.
Macros are expanded in #line arguments as they are in the #include directive.
The #line directive is primarily used by utilities that produce C code as output, and not in human-written code.