Filename and line information
来自cppreference.com
< cpp | preprocessor
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
包括其他源文件后,立即指令到当前源文件的行.
Original:
Includes other source file into current source file at the line immediately after the directive .
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
目录 |
[编辑] 语法
#line lineno
|
(1) | ||||||||
#line lineno "filename"
|
(2) | ||||||||
[编辑] 解释
改变目前的预处理行号,lineno超越了这一点。展开的宏观__LINE__将扩大到lineno加上一些实际遇到的源代码行以来
2) Original:
Changes the current preprocessor line number to lineno. Expansions of the macro __LINE__ beyond this point will expand to lineno plus the number of actual source code lines encountered since.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
改变当前的预处理文件名filename的宏观扩张__FILE__从这个角度会产生filename
Original:
Also changes the current preprocessor file name to filename. Expansions of the macro __FILE__ from this point will produce filename.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
任何预处理标记(宏常数或表达式)都可以作为参数
#line,只要他们扩大到一个有效的十进制整数,可以有效的字符串Original:
Any preprocessing tokens (macro constants or expressions) are permitted as arguments to
#line as long as they expand to a valid decimal integer optionally following a valid character string.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[编辑] 注释
使用此指令在这种情况下,一些自动代码代工具它产生Ç+ +源文件从另一种语言编写的文件。
#line指令插入在的产生Ç+ +文件引用的行数和在文件名的原(人可编辑)源文件Original:
This directive is used by some automatic code generation tools which produce C++ source files from a file written in another language. In that case,
#line directives may be inserted in the generated C++ file referencing line numbers and the file name of the original (human-editable) source file.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[编辑] 为例
#include <cassert> #define FNAME "test.cc" int main() { #line 777 FNAME assert(2+2 == 5); }
Output:
test: test.cc:777: int main(): Assertion `2+2 == 5' failed.