structure alignment
Adam Sansier via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Jul 12 08:13:13 PDT 2016
On Tuesday, 12 July 2016 at 15:08:29 UTC, Adam D. Ruppe wrote:
> On Tuesday, 12 July 2016 at 14:54:25 UTC, Adam Sansier wrote:
>> 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?
>
> This is trivial, just add it to the bindings.
>
> :s/struct \(.*\) {/struct \1 {\ralign(1):
It's not trivial, a global modifier similar to pragma(align(n))
would be trivial.
Your method makes many assumptions that may not hold. What if the
struct is templated(possible), what if it has comments after
struct and before {, etc? It's a hack that is not a solution. The
proper solution is to have a way to properly specify that a
struct has all members aligned without having to specify it on
all members or per struct.
More information about the Digitalmars-d-learn
mailing list