alignas specifier
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. |
Specifica i requisiti di allineamento di un tipo o di un oggetto.
Original:
Specifies the alignment requirement of a type or an object.
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.
Indice |
[modifica] Sintassi
alignas( expression )
|
(dal C++11) | ||||||||
alignas( type-id )
|
(dal C++11) | ||||||||
[modifica] Spiegazione
Lo specificatore alignas può essere applicato alla dichiarazione di una variabile o di un membro di dati di classe, oppure può essere applicato alla definizione di una classe / struct / union o enum.
Original:
The alignas specifier may be applied to the declaration of a variable or a class data member, or it can be applied to the definition of a class/struct/union or enum.
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.
Quando utilizzato in forma alignas(expression), e expression è un'espressione costante integrale che restituisce un valore positivo, l'entità dichiarato avrà il suo set requisito allineamento esattamente il risultato della expression, salvo che indebolirebbe la condizione naturale allineamento del tipo.
Original:
When used in form alignas(expression), and expression is an integral constant expression that evaluates to a positive value, the declared entity will have its alignment requirement set to exactly the result of the expression, except if it would weaken the natural alignment requirement of the type.
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.
Quando utilizzato in forma alignas(type), è esattamente equivalente a alignas(alignof(type)), cioè, la condizione di allineamento dell'entità dichiarati sarà uguale al requisito di allineamento type
Original:
When used in form alignas(type), is exactly equivalent to alignas(alignof(type)), that is, the alignment requirement of the declared entity will be equal the alignment requirement of type
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] Note
alignas(0) non ha alcun effetto.
Original:
alignas(0) has no effect.
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.
Quando più specificatori alignas sono applicati alla stessa variabile o di classe, la massima si è utilizzato.
Original:
When multiple alignas specifiers are applied to the same variable or class, the strictest one is 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.
Il linguaggio C definisce alignas come macro di preprocessore in <stdalign.h> intestazione, ma in C + + si tratta di una parola chiave, e le intestazioni <stdalign.h> e <cstdalign> non definiscono tale macro. Essi, tuttavia, definire la macro __alignas_is_defined costante.
Original:
The C language defines alignas as a preprocessor macro in the header <stdalign.h>, but in C++ this is a keyword, and the headers <stdalign.h> and <cstdalign> do not define such macro. They do, however, define the macro constant __alignas_is_defined.
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] Parole chiave
[modifica] Esempio
// every object of type sse_t will be aligned to 16-byte boundary struct alignas(16) sse_t { float sse_data[4]; }; // the array "cacheline" will be aligned to 128-byte boundary char alignas(128) cacheline[128];
[modifica] Vedi anche
alignof operator | queries alignment requirements of a type (dal C++11) |
(C++11) |
ottiene requisiti di allineamento del tipo Original: obtains the type's alignment requirements The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (classe template) |