Comments
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. |
Kommentare dienen als eine Art in-Code-Dokumentation. Wenn in einem Programm eingefügt werden, werden sie effektiv vom Compiler ignoriert, sie dienen lediglich als Hinweise von den Menschen, die Quellcode lesen, verwendet werden. Obwohl spezifische Dokumentation ist nicht Teil der C + +-Standard, verschiedene Dienstprogramme gibt, dass parse Kommentare mit verschiedenen Unterlagen Formate .
Original:
Comments serve as a sort of in-code documentation. When inserted into a program, they are effectively ignored by the compiler; they are solely intended to be used as notes by the humans that read source code. Although specific documentation is not part of the C++ standard, several utilities exist that parse comments with different documentation formats.
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.
Inhaltsverzeichnis |
[Bearbeiten] Syntax
/* comment */
|
(1) | ||||||||
// comment\n
|
(2) | ||||||||
Oft als "C-Stil" oder "multi-line", kommentiert bekannt .
2) Original:
Often known as "C-style" or "multi-line" comments.
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.
Oft als "C + +-Stil" oder "single-line", kommentiert bekannt .
Original:
Often known as "C++-style" or "single-line" comments.
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.
[Bearbeiten] C-Stil
C-Kommentare sind in der Regel verwendet, um große Textblöcke kommentieren, sie können jedoch verwendet werden, um einzelne Zeilen zu kommentieren. Um einen C-style Kommentar einzufügen, einfach Surround-Text mit
/* und */, das bewirkt, dass die Inhalte der Kommentar vom Compiler ignoriert werden. Es ist zwar nicht Teil der C + +-Standard, /** und */ sind oft verwendet, um Dokumentation Blöcke geben, das ist legal, weil der zweite Stern wird einfach als Teil des Kommentars behandelt. C-Kommentare können nicht verschachtelt werden .Original:
C-style comments are usually used to comment large blocks of text, however, they can be used to comment single lines. To insert a C-style comment, simply surround text with
/* and */; this will cause the contents of the comment to be ignored by the compiler. Although it is not part of the C++ standard, /** and */ are often used to indicate documentation blocks; this is legal because the second asterisk is simply treated as part of the comment. C-style comments cannot be nested.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.
C-Kommentare sind oft in Umgebungen bevorzugt, wo C und C + +-Code gemischt werden, da sie die einzige Form der Kommentar, der in der C-Standard (vor C99) verwendet werden können .
Original:
C-style comments are often preferred in environments where C and C++ code may be mixed, because they are the only form of comment that can be used in the C standard (prior to C99).
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.
[Bearbeiten] C + +-Stil
C-Kommentare werden in der Regel verwendet, um einzelne Zeilen kommentieren, jedoch mehrere C + +-Stil Kommentare können zusammen gelegt werden, um mehrzeilige Kommentare zu bilden. C + +-Stil Kommentare sagen, dass der Compiler alle Inhalte zwischen
// und eine neue Linie, die sie sehr nützlich macht ignorieren .Original:
C-style comments are usually used to to comment single lines, however, multiple C++-style comments can be placed together to form multi-line comments. C++-style comments tell the compiler to ignore all content between
// and a new line, which makes them very useful.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.
[Bearbeiten] Beispiel
/* C-style comments can contain multiple lines */ /* or just one */ // C++-style comments can comment one line // or, they can // be strung together int main() { // The below code won't be run // return 1; // The below code will be run return 0; }