Can we just have struct inheritence already?
Walter Bright
newshound2 at digitalmars.com
Tue Jun 11 06:29:58 UTC 2019
On 6/10/2019 3:49 AM, Vladimir Panteleev wrote:
> On Monday, 10 June 2019 at 03:08:26 UTC, Walter Bright wrote:
>> The reason is so that each struct instance is at a unique address.
> What advantages does this provide? Surely it can't be more important than being
> able to place behavior/policy in structs with no overhead?
I don't remember all the rationale (30 years ago!), but a couple reasons are:
1. How would an array of 0 size elements work, when the pointer past the end is
the same as the pointer to the start?
2. How would you determine the dimension of an array of 0 size elements?
sizeof(Array)/sizeof(Array[0])
? Oops!
More information about the Digitalmars-d
mailing list