what does #line do?

E

Emmanuel Delahaye

In said:
What does

#line 182 parser.y

mean in a C program?

6.10.4 Line control
Constraints
1 The string literal of a #line directive, if present, shall be a
character string literal.
Semantics
2 The line number of the current source line is one greater than the
number of new-line characters read or introduced in translation phase 1
(5.1.1.2) while processing the source file to the current token.
3 A preprocessing directive of the form
# line digit-sequence new-line
causes the implementation to behave as if the following sequence of source
lines begins with a source line that has a line number as specified by the
digit sequence (interpreted as a decimal integer). The digit sequence
shall not specify zero, nor a number greater than 2147483647.
4 A preprocessing directive of the form
# line digit-sequence "s-char-sequenceopt" new-line
sets the presumed line number similarly and changes the presumed name of
the source file to be the contents of the character string literal.
5 A preprocessing directive of the form
# line pp-tokens new-line
(that does not match one of the two previous forms) is permitted. The
preprocessing tokens after line on the directive are processed just as in
normal text (each identifier currently defined as a macro name is replaced
by its replacement list of preprocessing tokens). The directive resulting
after all replacements shall match one of the two previous forms and is
then processed as appropriate.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,145
Messages
2,570,824
Members
47,370
Latest member
desertedtyro29

Latest Threads

Top