I need to declare type alias for 2 bytes variable aligned by 4 bytes.
In GCC, XL C/C++ (AIX), aCC (HP-UX) I can use this code:
typedef uint16_t AlignedType __attribute__ ((aligned (4)));
In Windows I can use:
typedef __declspec(align(4)) unsigned __int16 AlignedType;
How can I declare same type in SunStudio C++ 11?
"pragma align" isn't suitable because it works only for global or static variable and It requires variable name.
For future references, when the compilers catch up, C++11 has standard alignment attributes, see
alignas
([dcl.align] in N3242).