Comments
提供: cppreference.com
< cpp
![]() |
このページは、Google 翻訳を使って英語版から機械翻訳されました。
翻訳には誤りや奇妙な言い回しがあるかもしれません。文章の上にポインタをおくと、元の文章が見れます。誤りを修正して翻訳を改善する手助けをしてください。翻訳についての説明は、ここをクリックしてください。 |
コメントは、インコードのドキュメントのようなものとして機能します。プログラムに挿入すると、それらは効果的にコンパイラによって無視されるのではなく、単にソースコードを読んで、人間が音として使用することを意図している。固有のドキュメントには、C + +標準には、いくつかのユーティリティが異なるドキュメント形式とその解析のコメントを存在の一部ではありませんが.
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.
目次 |
[編集] 構文
/* comment */
|
(1) | ||||||||
// comment\n
|
(2) | ||||||||
多くの場合、 "Cスタイル"または "マルチライン"コメントとして知られている.
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.
多くの場合、 "C + +スタイル"または "単一行"コメントとして知られている.
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.
[編集] Cスタイル
Cスタイルのコメントは、通常、テキストの大きなブロックをコメントアウトするために使用されているが、それらは単一の行をコメントアウトするために使用することができます。 Cスタイルのコメントを挿入するには、単に
/*
でテキストを囲むと*/
、これは、コメントの内容は、コンパイラによって無視されることになります。それはC + +標準の一部ではありませんが、/**
と*/
しばしばドキュメントブロックを示すために使用され、第二アスタリスクは単にコメントの一部として扱われるため、これは合法です。 Cスタイルのコメントは入れ子にすることができません.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スタイルのコメントは、多くの場合、彼らはC規格(前C99まで)で使用することができ、コメントの唯一の形式ですので、CとC + +のコードを、混合してもよい..環境で好まれる
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.
[編集] C + +スタイル
Cスタイルのコメントは通常、単一の行をコメントにするために使用されているが、複数のC + +スタイルのコメントは複数行のコメントを形成するために一緒に配置することができます。 C + +スタイルのコメントは
//
、それらを非常に有用に新しい行、間にあるすべての内容を無視するようにコンパイラに指示.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.
[編集] 例
このコードを実行します
/* 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; }