attribute specifier sequence(dal C++11)
Da cppreference.com.
![]() |
Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate.
La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
Introduce attuazione attributi definiti per i tipi, oggetti, codici, ecc
Original:
Introduces implementation-defined attributes for types, objects, code, etc.
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.
[[
attr]]
[[
attr1, attr2, attr3(
args)
]]
[[
namespace::
attr(
args)
]]
alignas_specifier
[modifica] Spiegazione
Gli attributi forniscono la sintassi standard unificato per l'attuazione definite le estensioni del linguaggio, come la GNU e le estensioni del linguaggio IBM
__attribute__((...))
, estensione Microsoft __declspec()
, eccOriginal:
Attributes provide the unified standard syntax for implementation-defined language extensions, such as the GNU and IBM language extensions
__attribute__((...))
, Microsoft extension __declspec()
, etc.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.
Un attributo può essere utilizzato in quasi tutto il programma C + +, e può essere applicato a quasi tutto: ai tipi, alle variabili, alle funzioni, ai nomi, ai blocchi di codice, per unità di traduzione intere, anche se ogni particolare attributo è valido solo qualora è consentita dalla implementazione:
[[probably(true)]]
può essere utilizzato solo con un if, e non con una dichiarazione di classe. [[omp::parallel()]]
può applicare a un blocco di codice o di un ciclo for, ma non al tipo int
, eccOriginal:
An attribute can be used almost everywhere in the C++ program, and can be applied to almost everything: to types, to variables, to functions, to names, to code blocks, to entire translation units, although each particular attribute is only valid where it is permitted by the implementation:
[[probably(true)]]
can only be used with an if, and not with an class declaration. [[omp::parallel()]]
can apply to a code block or to a for loop, but not to the type int
, etc.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.
In dichiarazioni, gli attributi possono apparire sia prima e subito dopo il nome del soggetto che viene dichiarato, nel qual caso essi sono combinati. Nella maggior parte delle altre situazioni, gli attributi si applicano alla società direttamente precedente.
Original:
In declarations, attributes may appear both before and directly after the name of the entity that is declared, in which case they are combined. In most other situations, attributes apply to the directly preceding entity.
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.
alignas_specifier è una parte della sequenza identificatore di attributo, anche se ha una sintassi diversa. Può apparire, dove gli attributi
[[...]]
appaiono e può mescolare con loro (a condizione che sia utilizzato dove alignas è consentito)Original:
alignas_specifier is a part of the attribute specifier sequence, although it has different syntax. It may appear where the
[[...]]
attributes appear and may mix with them (provided it is used where alignas is permitted)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.
[modifica] Attributi standard
Solo i seguenti due attributi sono definiti dal C + + standard. Tutti gli altri attributi sono l'attuazione specifica.
Original:
Only the following two attributes are defined by the C++ standard. All other attributes are implementation-specific.
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.
[[noreturn]]
|
Indica che la funzione non restituisce.
Questo attributo si applica per un funzionamento solo dichiarazioni. Il comportamento è indefinito se la funzione con questo attributo restituisce effettivamente. The seguenti funzioni standard di questo attributo: std::_Exit, std::abort, std::exit, std::quick_exit, std::unexpected, std::terminate, std::rethrow_exception, std::throw_with_nested, std::rethrow_nested Original: Indicates that the function does not return. This attribute applies to function declarations only. The behavior is undefined if the function with this attribute actually returns. The following standard functions have this attribute: std::_Exit, std::abort, std::exit, std::quick_exit, std::unexpected, std::terminate, std::rethrow_exception, std::throw_with_nested, std::rethrow_nested The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[[carries_dependency]]
|
Indica che la catena di dipendenza nel comunicato-consumare std::memory_order propaga dentro e fuori della funzione, che consente al compilatore di saltare inutili recinzione attributo memoria instructions.
This può apparire in due situazioni: 1) si può applicare alle dichiarazioni di parametri di una funzione o lambda-espressioni, nel qual caso esso indica che l'inizializzazione del parametro porta in dipendenza lvalue a rvalue conversione che object. Original: Indicates that dependency chain in release-consume std::memory_order propagates in and out of the function, which allows the compiler to skip unnecessary memory fence instructions. This attribute may appear in two situations: 1) it may apply to the parameter declarations of a function or lambda-expressions, in which case it indicates that initialization of the parameter carries dependency into lvalue-to-rvalue conversion of that object. The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[modifica] Esempio
This section is incomplete Reason: no example |