On 8/8/17 3:59 PM, Johan Engelen wrote:
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;

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

In fact it's not doing any dereferencing. It's just under the hood passing a pointer.

However, the in contract does actually enforce the requirement.

And adds null pointer checks even when clearly not needed.

Clearly not needed? I thought the point was to ensure the reference is not null?


Reply via email to