Can we just have struct inheritence already?

Walter Bright newshound2 at digitalmars.com
Thu Jun 13 00:37:46 UTC 2019


On 6/12/2019 5:18 PM, Timon Gehr wrote:
> Undefined values are not undefined behavior.

I think that is the salient point. You're right.


> However, there are potential problems, based on which properties you want to 
> assume that strongly pure functions have:
> 
> 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.

Optimizing it means caching the returned value. I don't see how that can lead to 
undefined behavior.


More information about the Digitalmars-d mailing list