On Wednesday, 7 December 2016 at 10:25:56 UTC, Walter Bright wrote:
On 12/4/2016 8:41 PM, Stefan Koch wrote:
What is your opinion, should we warn if we unambiguously detect something that
is clearly unwanted ?
It's an old idea, and comes up regularly.

This all sounds like a great idea, and I've tried it. Unfortunately, it runs afoul of code like this:

  int i;
  int* p = null;
  if (c)
    p = &i;
  ...code...
  if (c)
    *p = 3; // Warning Will Robinson! p could be null!

That is why I said unambiguously.
We will neither warn or error in the above case, because p could have been assigned to. Only if we directly read from something uninitialized will we error.

Reply via email to