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.
[править] Notes
Эта директива используется некоторые автоматическая генерация кода инструменты, которые производят C + файлы + источник из файла, написанного на другом языке. В этом случае,
#line директивы могут быть вставлены в создаваемый C + + файл ссылается номер строки и имя файла оригинала (человек-редактирования) исходных файлов.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); }
Вывод:
test: test.cc:777: int main(): Assertion `2+2 == 5' failed.