The accepted answer (“No”) is correct, but I wanted to clarify one potentially misleading part of it. I would add a comment, but I need to format the code; hence the new answer.
typedefs are simply aliases or aliases for the specified specific type, they do not exist as a separate type to have different alignment, packaging, etc.
This is not true, at least for GCC (OP compiler) and GHS. For example, the following compilation is error-free, showing that alignment can be attached to a typedef.
Perverted alignment (larger than the size of the object) is simply an impact and entertaining value.
#define CASSERT( expr ) { typedef char cassert_type[(expr) ? 1 : -1]; } typedef __attribute__((aligned(64))) uint8_t aligned_uint8_t; typedef struct { aligned_uint8_t t; } contains_aligned_char_t; void check_aligned_char_semantics() { CASSERT(__alignof(aligned_uint8_t) == 64); CASSERT(sizeof(aligned_uint8_t) == 1); CASSERT(sizeof(contains_aligned_char_t) == 64); }
Paul du bois
source share