[GD-Windows] using typedef to create aligned types
Brought to you by:
vexxed72
From: Andras B. <bn...@ma...> - 2004-12-01 23:45:59
|
MSDN says that I can use typedef to make aligned versions of my types, eg: typedef __declspec(align(16)) Fred FredAligned16; This works when I declare variables, eg: Fred fred1; FredAligned16 fred2; fred2 is 16 bytes aligned, while fred1 is not But the strange thing is that sizeof(Fred) == sizeof(FredAligned16) is true, even though Fred's size is not a multiple of 16 bytes... When I declare different types (ie. not using typedef), then the sizeof will be different because the aligned type will be padded to the next multiple of 16 bytes. Is this a bug in the compiler?? Thanks, Andras |