Can we just have struct inheritence already?

Meta jared771 at gmail.com
Wed Jun 12 02:40:41 UTC 2019


On Tuesday, 11 June 2019 at 23:47:00 UTC, Manu wrote:
> On Tue, Jun 11, 2019 at 1:25 PM Meta via Digitalmars-d 
> <digitalmars-d at puremagic.com> wrote:
>>
>> Quick question, Manu. What are referring to when you say 
>> "uninitialized data"? Do you mean:
>>
>> int n = void;
>> n++; //Undefined behaviour
>>
>> Struct S { int getVal() { return 1; } }
>> S s = void;
>> s.getVal(); //Undefined behaviour
>>
>> Or do you mean:
>>
>> int n;
>> n++;
>>
>> S s;
>> s.getVal();
>
> I mean uninitialised, ie, the former code (= void). Your later 
> code is
> default initialised.

In that case, yes, I'm in 110% agreement with you. 
Default-uninitialized variables are a well-known source of 
security vulnerabilities, and I thought that D *already* 
disallowed them in @safe code. This is a no-brainer.


More information about the Digitalmars-d mailing list