www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: safe inference fundamentally broken

On Thu, 05 Jun 2014 14:09:44 -0400
Steven Schveighoffer via Digitalmars-d <digitalmars-d puremagic.com>
wrote:

 I propose that we start migrating towards making slicing of stack
 data un- safe, first by making it a warning, enabled with -w. Then
 making it an error.

I reported this quite some time ago, but unfortunately, it has yet to be fixed. https://issues.dlang.org/show_bug.cgi?id=8838 The bizarre thing though is that in the original thread where I brought it up, some folks fought it, arguing that it should be considered safe. However, slicing a static array is no different from taking the address of a local variable, so they should definitely be treated the same. On a related note, I very much wish that there was no implicit slicing of static arrays in the language. It's just begging for bugs IMHO - precisely for the same kinds of reasons that automatically converting a local variable to a pointer to that variable would create bugs. But unfortunately, I think that fix that now would be a very tough sell. - Jonathan M Davis
Jun 05 2014