Comments
De 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. |
Comentarios servir como una especie de documentación en el código. Cuando se inserta en un programa, están efectivamente ignorados por el compilador; ellos están únicamente destinados a ser utilizados como notas de los seres humanos que leen el código fuente. Aunque la documentación específica que no es parte del estándar C + +, existen varias utilidades que los comentarios analizan con diferentes formatos de documentación .
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.
Contenido |
[editar] Sintaxis
/* comment */
|
(1) | ||||||||
// comment\n
|
(2) | ||||||||
A menudo conocido como "C-estilo" o "multi-línea", comenta .
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.
A menudo conocido como "C + +-estilo" o "una sola línea", comenta .
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.
[editar] C-estilo
C-comentarios tipo se utilizan generalmente para comentar grandes bloques de texto, sin embargo, que se puede utilizar para comentar líneas simples. Para insertar un comentario de C-estilo, simplemente rodear el texto con
/* y */, lo que hará que el contenido del comentario que serán ignorados por el compilador. Aunque no es parte del estándar C + +, y /** */ se utilizan a menudo para indicar los bloques de documentación, lo que es legal porque el segundo asterisco simplemente se trata como parte del comentario. C-estilo de comentarios no pueden anidarse .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 comentarios del estilo se prefieren a menudo en entornos en los que C y C + + se pueden mezclar, porque son la única forma de comentario que puede ser utilizado en el estándar de C (antes de C99) .
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.
[editar] C + +-estilo
C-estilo de los comentarios se utiliza generalmente para hacer comentarios líneas simples, sin embargo, varios C + +-estilo comentarios pueden colocarse juntos para formar multilínea comentarios. C + + comentarios del estilo indicar al compilador que ignore todos los contenidos entre
// y una nueva línea, lo que los hace muy útiles .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.
[editar] Ejemplo
/* 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; }