On Tuesday, 20 November 2018 at 00:30:44 UTC, Jordi GutiƩrrez Hermoso wrote:

Yeah, maybe this bit of C++ syntax isn't the best idea. What about other alternatives?

You could try testing for null before dereferencing ;-)

If the following code in D, did what you'd reasonably expect it to do, then you could do this:

-----
module test;

import std.stdio;

class C { public int x; }

void main()
{
  try
  {
    C c = null;
    c.x = 100;
  }
  catch(Exception e)
  {
    writeln(e.msg);
  }

}
-----

Reply via email to