◐ Shell
clean mode source ↗

Filename and line information - cppreference.com

De cppreference.com

<metanoindex/>

Inclui arquivo de outra fonte em arquivo de fonte de corrente na linha imediatamente após a diretiva.

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.

Sintaxe

#line lineno (1)
#line lineno "filename" (2)

Explicação

Altera o número da linha atual de pré-processamento para lineno. expansões do __LINE__ macro além deste ponto vai se expandir para lineno mais o número de linhas de código fonte reais encontradas desde.

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.

2)

Também altera o nome do arquivo atual pré-processador para filename. Expansões da macro __FILE__ a partir deste ponto vai produzir 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.

Qualquer fichas de pré-processamento (constantes macro ou expressões) são permitidos como argumentos para #line, desde que se expandir para um decimal inteiro válido, opcionalmente, após uma seqüência de caracteres válido.

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.

Notas

Esta directiva é usada por algumas ferramentas de código automáticas geração que produzem C + arquivos de origem + a partir de um arquivo escrito em outro idioma. Nesse caso, as directivas #line pode ser inserido no gerado arquivo C + + números de linha referência eo nome do arquivo (humano-editável) fonte original.

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.

Exemplo

#include <cassert>
#define FNAME "test.cc"
int main()
{
#line 777 FNAME
        assert(2+2 == 5);
}

Saída:

test: test.cc:777: int main(): Assertion `2+2 == 5' failed.