Quantcast
Channel: User CPlus - Programming Language Design and Implementation Stack Exchange
Viewing all articles
Browse latest Browse all 65

Why would a language have a concept of undefined behavior instead of raising an error?

$
0
0

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 happen, might error, might work, might work some of the time.'

What are the advantages of leaving behavior undefined as opposed to raising an error on an invalid program?


Viewing all articles
Browse latest Browse all 65

Trending Articles