Qualificatifs const et volatile
De cppreference.com
![]() |
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. |
const
- définit que le type est constant .volatile
- définit que le type est volatil .mutable
- définit qu'un membre d'une classe n'affecte pas l'état visible de l'extérieur de la classe. Les membresmutable
peuvent être modifiés dans les classes constantes, cette propriété est en effet ignorée pour les membres mutable.
[modifier] Explication
- Remarque:cv-qualificatifs et cv-prescripteurs (liste ci-dessus) ne sont pas les mêmes thing.
la CV-qualification sont propriétés d'un type alors que cv-prescripteurs sont fonction de la langue de définir cv-qualificationsOriginal:Note: cv-qualifiers and cv-specifiers (list above) are not the same thing.
The cv-qualifiers are properties of a type whereas cv-specifiers are language feature to define cv-qualifiersThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Cv qualificatifs définir deux propriétés de base d'un type: constness''' et de la volatilité. Un CV-Qualifier peut être l'un des suivants:
'const volatile'
, 'const'
, 'volatile'
ou 'none'
. const
définit qu'un type est'' constant, volatile
définit que le type est' volatile. Type non-constante et non volatile n'a pas de restrictions supplémentaires, tandis que constante et volatile signifie ce qui suit:Original:
Cv-qualifiers define two basic properties of a type: constness and volatility. A cv-qualifer can be one of the following:
'const volatile'
, 'const'
, 'volatile'
or 'none'
. const
defines that a type is constant, volatile
defines that the type is volatile. Non-constant and non-volatile type has no additional restrictions, whereas constant and volatile imply the following: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.
- ' Constant' - l'objet ne doit pas être modifié. Essayer de le faire entraîne un comportement indéfini. Sur la plupart des compilateurs, il est temps de compilation erreur .Original:constant - the object shall not be modified. Attempt to do so results in undefined behavior. On most compilers it is compile-time error.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - ' Volatile »- l'objet peut être modifié par des moyens non détectables par le compilateur et donc quelques optimisations du compilateur doit être désactivé .Original:volatile - the object can be modified by means not detectable by the compiler and thus some compiler optimizations must be disabled.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Il est d'ordre partiel de cv-qualifiés par l'ordre des restrictions croissantes. Le type peut dire plus ou moins cv-qualifié alors:
Original:
There is partial ordering of cv-qualifiers by the order of increasing restrictions. The type can be said more or less cv-qualified then:
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.
- Sans réserve <
const
Original:unqualified <const
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - Sans réserve <
volatile
Original:unqualified <volatile
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - Sans réserve <
const volatile
Original:unqualified <const volatile
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. -
const
<const volatile
-
volatile
<const volatile
-
Toute cv-qualifications font partie de la définition de type, donc avec différents types cv-qualifications sont toujours différents types. Par conséquent coulée est nécessaire pour correspondre à des types lors de l'affectation des variables, des fonctions d'appel, etc Seulement coulée à plus cv-qualifié type se fait automatiquement dans le cadre de <div class="t-tr-text"> les conversions implicites
. En particulier, les conversions suivantes sont autorisées:Original:
implicit conversions
The 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.
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.
Original:
Any cv-qualifiers are part of the type definition, hence types with different cv-qualifications are always different types. Therefore casting is needed to match types when assigning variables, calling functions, etc. Only casting to more cv-qualified type is done automatically as part of
les conversions implicites</div>. In particular, the following conversions are allowed:
Original:
implicit conversions
The 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.
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.
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.
- ' Type non qualifié peut être converti en
const
Original:unqualified type can be converted toconst
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - ' Type non qualifié peut être converti en
volatile
Original:unqualified type can be converted tovolatile
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - ' Type non qualifié peut être converti en
const volatile
Original:unqualified type can be converted toconst volatile
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - Type
const
peut être converti enconst volatile
Original:const
type can be converted toconst volatile
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - Type
volatile
peut être converti enconst volatile
Original:volatile
type can be converted toconst volatile
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
-
Pour convertir un moins cv-qualifié type, const_cast doit être utilisé .
Original:
To convert to a less cv-qualified type, const_cast must be used.
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.
[modifier] Mots-clés
[modifier] Exemple
This section is incomplete |