Release D 2.079.0
psychoticRabbit
meagain at meagain.com
Tue Mar 6 16:13:24 UTC 2018
On Tuesday, 6 March 2018 at 07:11:24 UTC, Jonathan M Davis wrote:
>
> That example actually should be perfectly @safe, because the
> array is null, and it's using writeln. Dereferencing null is
> @safe, because it segfaults and thus can't corrupt memory or
> access invalid memory. You obviously don't want it to happen,
> but it's @safe. Also, passing a pointer to writeln is fine,
> because it's just going to print the value, so that's @safe
> too, even if the pointer value is garbage.
>
my point had nothing to do with writeln.
my point was, that a RangeError exception may help save the day,
but not when you use .ptr
thankfully Steven gave a much better example to make the point
clearer ;-)
(I assume that int is meant to be size_t)
More information about the Digitalmars-d-announce
mailing list