alignas specifier
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. |
Especifica el requisito de alineación de un tipo o un objeto .
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.
Contenido |
[editar] Sintaxis
alignas( expression )
|
(ya que C + +11) | ||||||||
alignas( type-id )
|
(ya que C + +11) | ||||||||
[editar] Explicación
El especificador alignas se puede aplicar a la declaración de una variable o un miembro de la clase de datos, o puede ser aplicado a la definición de una clase / struct / union o enumeración .
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.
Cuando se utiliza en forma alignas(expression), y expression es una expresión integral constante que se evalúa en un valor positivo, la entidad declarada tendrá su requisito de alineación a exactamente el resultado de la expression, excepto si se debilitaría el requisito de alineación natural 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.
Cuando se utiliza en forma alignas(type), es exactamente equivalente a alignas(alignof(type)), es decir, el requisito de alineación de la entidad declarada será igual al requisito de alineación de 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.
[editar] Notas
alignas(0) no tiene ningún efecto .
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.
Cuando múltiples especificadores alignas se aplican a la misma variable o de clase, la más estricta se usa uno .
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.
El lenguaje C define alignas como una macro de preprocesador en el <stdalign.h> cabecera, pero en C + + es una palabra clave, y las cabeceras de <stdalign.h> y <cstdalign> no definen macro tal. Ellos, sin embargo, definir la constante __alignas_is_defined macro .
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.
[editar] Palabras clave
[editar] Ejemplo
// 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];
[editar] Ver también
| alignof operator | queries alignment requirements of a type (ya que C + +11) |
| (C++11) |
obtiene requisitos del tipo de alineación 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. (clase de plantilla) |