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?