On Tue, 20 Nov 2018 23:14:27 +0000, Johan Engelen wrote:
> When you don't call `a.foo()` a dereference, you basically say that
> `this` is allowed to be `null` inside a class member function. (and then
> it'd have to be normal to do `if (this) ...` inside class member
> functions...)

That's what we have today:

    module scratch;
    import std.stdio;
    class A
    {
        int i;
        final void f()
        {
            writeln(this is null);
            writeln(i);
        }
    }
    void main()
    {
        A a;
        a.f();
    }

This prints `true` and then gets a segfault.

Virtual function calls have to do a dereference to figure out which 
potentially overrided function to call.
  • Re: Why does nobody seem ... Steven Schveighoffer via Digitalmars-d-learn
    • Re: Why does nobody ... Jordi GutiĆ©rrez Hermoso via Digitalmars-d-learn
      • Re: Why does nob... Steven Schveighoffer via Digitalmars-d-learn
        • Re: Why does... Jonathan M Davis via Digitalmars-d-learn
        • Re: Why does... Johan Engelen via Digitalmars-d-learn
          • Re: Why ... Steven Schveighoffer via Digitalmars-d-learn
            • Re:... Johan Engelen via Digitalmars-d-learn
              • ... Neia Neutuladh via Digitalmars-d-learn
              • ... Johan Engelen via Digitalmars-d-learn
              • ... Patrick Schluter via Digitalmars-d-learn
              • ... Johan Engelen via Digitalmars-d-learn
              • ... Steven Schveighoffer via Digitalmars-d-learn
              • ... Timon Gehr via Digitalmars-d-learn
            • Re:... NoMoreBugs via Digitalmars-d-learn
          • Re: Why ... Jonathan M Davis via Digitalmars-d-learn
          • Re: Why ... Johan Engelen via Digitalmars-d-learn
            • Re:... Kagamin via Digitalmars-d-learn
            • Re:... Jonathan M Davis via Digitalmars-d-learn

Reply via email to