On Tuesday, 8 August 2017 at 19:38:19 UTC, Steven Schveighoffer wrote:

Note that C++ also can do this, so I'm not sure the & is accomplishing the correct goal:

void foo(Klass&);

int main()
{
   Klass *k = NULL;
   foo(*k);
}

In C++, it is clear that the _caller_ is doing the dereferencing, and the dereference is also explicit.

However, the in contract does actually enforce the requirement.

And adds null pointer checks even when clearly not needed.

- Johan



Reply via email to