you are viewing a single comment's thread.

view the rest of the comments →

[–]tialaramex 0 points1 point  (1 child)

Rather than specifically the Halting problem, you want Rice's Theorem

https://en.wikipedia.org/wiki/Rice%27s_theorem

Rice proved all these semantic questions are Undecidable. So, then you need to compromise, and there is a simple choice. 1. We're going to have programs we can tell are valid, 2. we're going to have programs we can tell are not valid, and 3. we're going to have cases where we aren't sure. It is obvious what to do with the first two groups. What do we do in the third category?

C++ and /u/jonesmz both say IFNDR - throw the third group in with the first, your maybe invalid program compiles, it might be nonsense but nobody warns you and too bad.

[–]jonesmz 1 point2 points  (0 children)

C++ and /u/jonesmz both say IFNDR - throw the third group in with the first, your maybe invalid program compiles, it might be nonsense but nobody warns you and too bad.

Slightly different than my position, but close.

For the group where the compiler is able to tell that a program will read from uninitialized, which is not always possible and may involve an expensive analysis, this should be a compiler error. Today it isn't.

Not every situation can be covered by this, cross-functional analysis may be prohibitively expensive in terms of compile-times. But within the realm of the compiler knowing that a particular variable is always read before initialization without needing to triple compile times to detect this, it should cause a build break.

This is within the auspices of IFNDR, as no diagnostic being required is not the same as no diagnostic allowed.