Why does disabling a struct's postblit increase its size in memory?

kinke noone at nowhere.com
Sat Mar 2 19:11:42 UTC 2024


On Saturday, 2 March 2024 at 15:25:48 UTC, Per Nordlöw wrote:
> Why does disabling a struct's postblit increase its sizeof by 
> one word?
>
> The following holds:
>
> ```d
> struct S { @disable this(this); int _; }
> struct T { int _; }
> static assert(S.sizeof == 16);
> static assert(T.sizeof == int.sizeof);
> ```

Not according to run.dlang.io, for all available DMD versions. 
Perhaps your tested `S` was nested in some function/aggregate and 
so had an implicit context pointer.


More information about the Digitalmars-d-learn mailing list