structure alignment

Adam Sansier via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jul 12 07:54:25 PDT 2016


On Tuesday, 12 July 2016 at 14:26:54 UTC, Adam D. Ruppe wrote:
> On Tuesday, 12 July 2016 at 00:20:31 UTC, Adam Sansier wrote:
>> I need to align every member of every struct in a module. I 
>> can't simply add align(n) inside every struct because that 
>> seems ridiculous.
>
> Why are these structs needing the alignment?

Because god said so.. I can't change it, not everything is in my 
control.


>> From what I've read, align(n){ struct x; } only aligns the 
>> struct itself, is this true?
>
> Right. To align the members, you put align(x) on the individual 
> members (or align(x): at the top of the struct to apply to all 
> of them)
>
>> Is there a way to set global alignment for members per module 
>> or per scope?
>
> no

Um, because that's the way they were defined! So your telling me 
that D is going to make me mark every member align(n) when C++ 
has a global pragma align that does it for all in the scope? I 
thought D was better than C++?




More information about the Digitalmars-d-learn mailing list