-preview=in might break code

Steven Schveighoffer schveiguy at gmail.com
Fri Oct 2 19:37:43 UTC 2020


On 10/2/20 3:20 PM, Ola Fosheim Grøstad wrote:

> You can call something pass-by-value, but the compiler can still pass a 
> reference as long as it cannot be observed unless undefined behaviour 
> has been triggered by the programmer (by stepping outside the language).
> 

That's just the thing. The -preview=in feature does not define whether 
the parameter is pass by value or by reference. It says, "up to the 
compiler".

So code will work differently on different compilers.

I should be able to expect one behavior, and then if the compiler can 
pass the parameter differently but I can't tell, then that's fine. But 
this isn't that.

-Steve


More information about the Digitalmars-d mailing list