Introducing Nullable Reference Types in C#. Is there hope for D, too?
Adam D. Ruppe
destructionator at gmail.com
Fri Nov 17 13:16:05 UTC 2017
On Friday, 17 November 2017 at 01:47:01 UTC, Michael V. Franklin
wrote:
> It peeked my interested, because when I first started studying
> D, the lack of any warning or error for this trivial case
> surprised me.
You wanna get freaked out?
Try that very same trivial example with the `-O` option to dmd.
$ dmd -O pp
pp.d(20): Error: null dereference in function _Dmain
Yes, the optimizer has a compile time null check... but the mail
compiler doesn't. Walter has explained it is because the
optimizer does some flow analysis that the semantic step doesn't.
But still, sooooo weird.
More information about the Digitalmars-d
mailing list