Can we just have struct inheritence already?
Vladimir Panteleev
thecybershadow.lists at gmail.com
Sat Jun 15 10:19:25 UTC 2019
On Thursday, 13 June 2019 at 12:20:14 UTC, Patrick Schluter wrote:
>> If you try to malloc some number of zero-sized types naively,
>> you'll pass an allocation size of 0 to the allocator, which is
>> implementation-defined at best. Also you want to avoid
>> allocating these things anyway!
>>
> Especially if you use C allocation realloc() as calling it with
> size 0 is synonymous to free(). Ouch!
When would that be a problem? Any pointer is a valid pointer for
a zero-sized object, as it can never be meaningfully
"dereferenced" (never minding only pretending to do that for
purposes of metaprogramming and such).
More information about the Digitalmars-d
mailing list