Nasty supprise when using c 'anonymous struct and union' in D with 'static struct'
Arjan
arjan at ask.me.to
Tue Dec 29 20:07:29 UTC 2020
On Tuesday, 29 December 2020 at 17:49:20 UTC, Steven
Schveighoffer wrote:
> On 12/29/20 12:13 PM, Arjan wrote:
>> On Tuesday, 29 December 2020 at 14:42:07 UTC, Steven
>> Schveighoffer wrote:
>>> On 12/29/20 7:38 AM, Arjan wrote:
>>>> see https://en.cppreference.com/w/c/language/struct
> structs only add context pointers if nested in functions (and
> even then, only if it's not POD). If nested in structs,
> classes, or unions (or anything else), then no context pointer
> is added.
>
> So the answer is, don't use static.
That is what I discovered indeed. Thanks both for answering and
the additional information. This could however be made more
explicit and clear in the documentation.
More information about the Digitalmars-d-learn
mailing list