Espaces de noms
Variantes
Affichages
Actions

Comments

De cppreference.com.
< cpp

 
 
Langage C++
Sujets généraux
Contrôle de flux
Instructions conditionnelles
Instructions d'itération
Instructions de saut
Fonctions
déclaration de fonction
expression lambda
fonction générique
spécificateur inline
spécification d'exception (obsolète)
spécificateur noexcept (C++11)
Exceptions
Espaces de noms
Types
spécificateur decltype (C++11)
Qualificatifs
qualificatifs const et volatile
qualificatifs de stockage
qualificatif constexpr (C++11)
qualificatif auto (C++11)
qualificatif alignas (C++11)
Initialisation
Littéraux
Expressions
opérateurs alternatifs
Utilitaires
Types
déclaration typedef
déclaration d'alias de type (C++11)
attributs (C++11)
Jette
Original:
Casts
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
conversions implicites
conversion const_cast
conversion static_cast
conversion dynamic_cast
conversion reinterpret_cast
conversions style C et style fonction
Allocation de mémoire
Classes
Qualificatifs spécifiques aux membres de classe
Fonctions membres spéciales
Modèles
classes génériques
fonctions génériques
spécialisation de modèles
paquets de paramètres (C++11)
Divers
Assembleur
 
Commentaires servir comme une sorte de code dans la documentation. Lorsqu'elle est insérée dans un programme, ils sont effectivement ignoré par le compilateur, ils sont uniquement destinés à être utilisés sous forme de notes par les humains qui lisent le code source. Bien que la documentation spécifique ne fait pas partie du C + + standard, il existe plusieurs utilitaires que les commentaires analyser avec différents formats de documentation .
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.

Sommaire

[modifier] Syntaxe

/* comment */ (1)
// comment\n (2)
1)
Souvent appelé «C-style" ou "multi-lignes" commentaires .
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.
2)
Souvent appelé «C + +-style" ou "une seule ligne" commentaires .
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.

[modifier] C-style

Commentaires de style C. sont généralement utilisés pour commenter gros blocs de texte, cependant, ils peuvent être utilisés pour commenter les lignes simples. Pour insérer un commentaire de style C, encadrez le texte avec /* et */, ce qui provoquera le contenu du commentaire d'être ignoré par le compilateur. Bien qu'il ne fait pas partie du standard C + +, /** et */ sont souvent utilisées pour indiquer les blocs de documentation, ce qui est légal parce que le deuxième astérisque est simplement considérée comme faisant partie du commentaire. Commentaires de style C. ne peuvent pas être imbriquées .
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.
Commentaires de style C. On préfère souvent dans des environnements où C et C + + peuvent être mélangés, car ils sont la seule forme de commentaire qui peut être utilisé dans la norme C (avant 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.

[modifier] C + +-style

Commentaires de style C. sont généralement utilisés pour faire des observations lignes simples, cependant, plusieurs C + + style commentaires peuvent être assemblés pour former commentaires sur plusieurs lignes. C + + commentaires de style dire au compilateur d'ignorer tout le contenu entre // et une nouvelle ligne, ce qui les rend très utiles .
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.

[modifier] Exemple

/* 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;
}