Preprocessor
Aus cppreference.com
< cpp
![]() |
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. |
Der Präprozessor wird vor dem Compiler aufgerufen. Das Ergebnis des Präprozessors ist eine Datei, die an den Compiler weitergeleitet wird.
[Bearbeiten] Richtlinien
Die Präprozessordirektiven steuern das Verhalten des Präprozessors. Jede Anweisung belegt eine Zeile und hat folgendes Format:
-
#
Charakter - Präprozessorinstruktion (eine von
define
,undef
,include
,if
,ifdef
,ifndef
,else
,elif
,endif
,line
,error
,pragma
)[1] - Argumente (abhängig von der Instruktion)
- Zeilenumbruch
Die Null-Richtlinie (#
gefolgt von einen Zeilenumbruch) ist zulässig und hat keine Auswirkung.
[Bearbeiten] Fähigkeiten
Die Übersetzung der Quelldatei kann durch den Präprozessor wie folgt gesteuert werden:
- ' Kompilierung von Teilen der Quelldatei (gesteuert durch die Richtlinien
#if
,#ifdef
,#ifndef
,#else
,#elif
und#endif
) .Original:bedingt</div> compile of parts of source file (controlled by directiveOriginal:conditionallyThe text has been machine-translated via [http://translate.google.com Google Translate].
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.#if
,#ifdef
,#ifndef
,#else
,#elif
and#endif
).The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - ' replace' text Makros während möglicherweise Verkettung oder Quotierung von Bezeichnern (gesteuert durch Richtlinien
#define
und#undef
und Operatoren#
und##
)Original:replace text macros while possibly concatenating or quoting identifiers (controlled by directives#define
and#undef
, and operators#
and##
)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - 'include' andere Dateien (gesteuert durch die Richtlinie
#include
)Original:include other files (controlled by directive#include
)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - erzeugen eine Warnung warning (gesteuert durch die Richtlinie
#warning
)Original:cause a warning (controlled by directive#warning
)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - erzeugen einen Fehler error (gesteuert durch die Richtlinie
#error
)Original:cause an error (controlled by directive#error
)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Das Verhalten des Präprozessors kann wie folgt gesteuert werden:
Original:
The following aspects of the preprocessor can be controlled:
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.
- ' Verhalten (gesteuert durch die Richtlinien
#pragma
)Original:Implementierung definiert</div> behavior (controlled by directivesOriginal:implementation definedThe text has been machine-translated via [http://translate.google.com Google Translate].
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.#pragma
)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - ', die der Präprozessor (gesteuert durch Richtlinien
#line
)Original:Dateinamen und Online-Informationen</div> available to the preprocessor (controlled by directivesOriginal:file name and line informationThe text has been machine-translated via [http://translate.google.com Google Translate].
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.#line
)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
[Bearbeiten] Fussnoten
- ↑ Dies sind die Direktiven, die vomStandard definiert sind. Der Standard definiert kein Verhalten für ander Direktiven: sie könen ignoriert werden, eine sinnvolle Bedeutung haben oder einen Copilerfehler erzeugen. Auch wenn sie ignoriert werden, werden sie vom Quellcode entfernt wenn die Verarbeitung des Präprozessors abgeschlossen ist. Eine häufige nicht standardisierte Erweiterung ist die
#warning
Direktive, die während der Compilation eine benutzerdefinierte Meldung ausgibt.