Why does disabling a struct's postblit increase its sizeof by one word?
The following holds:
struct S { @disable this(this); int _; }
struct T { int _; }
static assert(S.sizeof == 16);
static assert(T.sizeof == int.sizeof);
. Why is this needed?
| Thread overview | |||||||
|---|---|---|---|---|---|---|---|
|
March 02 Why does disabling a struct's postblit increase its size in memory? | ||||
|---|---|---|---|---|
| ||||
Why does disabling a struct's postblit increase its sizeof by one word? The following holds:
. Why is this needed? | ||||
March 02 Re: Why does disabling a struct's postblit increase its size in memory? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Per Nordlöw | 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:
Not according to run.dlang.io, for all available DMD versions. Perhaps your tested | |||
March 02 Re: Why does disabling a struct's postblit increase its size in memory? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to kinke | On Saturday, 2 March 2024 at 19:11:42 UTC, kinke wrote: >Not according to run.dlang.io, for all available DMD versions. Perhaps your tested Ahh. Yes. Indeed. My mistake. Thanks. | |||
March 02 Re: Why does disabling a struct's postblit increase its size in memory? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Per Nordlöw | On Saturday, 2 March 2024 at 19:28:08 UTC, Per Nordlöw wrote: >On Saturday, 2 March 2024 at 19:11:42 UTC, kinke wrote: >Not according to run.dlang.io, for all available DMD versions. Perhaps your tested Ahh. Yes. Indeed. My mistake. Thanks. Thanks. Neither my websearches nor ChatGPT plus couldn't figure that out. | |||
March 03 Re: Why does disabling a struct's postblit increase its size in memory? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Per Nordlöw | On Saturday, 2 March 2024 at 19:29:47 UTC, Per Nordlöw wrote: >On Saturday, 2 March 2024 at 19:28:08 UTC, Per Nordlöw wrote: >On Saturday, 2 March 2024 at 19:11:42 UTC, kinke wrote: >Not according to run.dlang.io, for all available DMD versions. Perhaps your tested Ahh. Yes. Indeed. My mistake. Thanks. Thanks. Neither my websearches nor ChatGPT plus couldn't figure that out. FYI, you can dump the layout of a struct, including hidden fields, by iterating over its
This example prints out
| |||