On Friday, 29 August 2014 at 20:41:34 UTC, Ola Fosheim Grøstad
wrote:
On Friday, 29 August 2014 at 18:46:20 UTC, Marc Schütz wrote:
It does. An access that can potentially fault is more or less
equivalent to this:
if(p is null)
throw new Error();
*p = ...;
When you remove the access, you're removing the test, which
changes program semantics.
No, if the access can trap unexpectedly then the program was
incorrect to begin with. A deliberate exception is not the same
as an unexpected trap.
If it was indeed unexpected then you're right, but how do you
know it wasn't intentional? If accessing an invalid pointer isn't
unspecified behaviour (which this discussion is about), then why
shouldn't someone rely on it?