Getting action on your favorite D issues

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Sat Jun 6 22:07:52 UTC 2020


On Saturday, 6 June 2020 at 22:01:51 UTC, Steven Schveighoffer 
wrote:
> Yes, it's the same thing. This is why I specifically said that 
> the case of:
>
> int x = void;
>
> won't corrupt memory *as long as everything that uses it is 
> @safe*. This is due to the fact that all indexing operations in 
> @safe code are bounds-checked.

Ahh, gotcha.  I didn't quite follow the nuances there before.  
Thanks for clarifying, and for all the previous explanation.

> The thing we *should* do is just disallow all these corner 
> cases in @safe code. It's much easier to relax it in certain 
> cases later than it is to add on band-aids for all the bad 
> cases.
>
> I don't think the code breakage would be tolerable for many 
> people. Then again, maybe void initialization isn't common 
> enough to cause a lot of breakage, I don't know. But I'm sure 
> union usage is higher.

Could be interesting to put together compiler options to ban one 
or the other, and test them on a few major codebases (starting 
with druntime and phobos) to see how much breaks.  If nothing 
else it'd be useful information to consider for that D3 proposal 
... :-)


More information about the Digitalmars-d mailing list