Can we just have struct inheritence already?

Timon Gehr timon.gehr at gmx.ch
Thu Jun 13 11:30:20 UTC 2019


On 13.06.19 08:11, ag0aep6g wrote:
> On 13.06.19 02:18, Timon Gehr wrote:
>> int foo()@safe pure{
>>      int x=void;
>>      return x;
>> }
>>
>> Any code that is optimized based on the assumption that `foo()` will 
>> always return the same value will have undefined behavior, including 
>> the possibility of buffer overflows or dangling pointers.
> 
> In the same vein:
> 
> size_t foo() @safe pure
> {
>      return cast(size_t) new int;
> }

Yes. IMHO this shouldn't be a @safe pure operation.


More information about the Digitalmars-d mailing list