2 ms·
It is true that the language has failed to provide tools that help developers prevent UB and that this is a very bad thing for the ecosystem. It can change, tho
by UncleMeat 4y ago
It is true that the language has failed to provide tools that help developers prevent UB and that this is a very bad thing for the ecosystem. It can change, though.
In practice, compilers aren't actually adversarial. A lot of the discussion around UB is catastrophizing and talks about how the compiler will order you pizza or delete your disk. Some problems are real and I know some people whose graduate school work was very specifically on the problems that this causes for security-related checks but compilers really really do not transform your program into "complete garbage." They transform your program into a program with a bug, which is a true statement about that program.
I'm reminded of the apocryphal story about being asked how a computer knows how to do the right thing if given the wrong inputs. This feels similar.
- Karellen 4y agoNot apocryphal: > On two occasions I have been asked, — "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" In one case a member of the Upper, and in the other a member of the Lower, House put this question. I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question. -- Charles Babbage https://en.wikiquote.org/wiki/Charles_Babbage#Passages_from_the_Life_of_a_Philosopher_(1864) https://en.wikiquote.org/wiki/Charles_Babbage#Passages_from_...