Skip to main content

All Questions

Filter by
Sorted by
Tagged with
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 ...
CPlus's user avatar
  • 9,143
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 ...
Robert Columbia's user avatar