All Questions
Tagged with error-handling undefined-behavior
2 questions
34
votes
9
answers
4k
views
Why would a language have a concept of undefined behavior instead of raising an error?
Certain constructs or conditions in programming just are not allowed. Languages such as Java or Swift handle these by raising an error when encountered. C and C++ on the other hand say 'Anything could ...
21
votes
6
answers
3k
views
How does one transpile valid code that corresponds to undefined behavior in the target language?
Consider the following C# snippet:
Object bad= null;
Console.WriteLine(bad.ToString());
This is valid C#. It will raise a ...