C++ - Enumerating Undefined Behavior

2023/07/20
This article was written by an AI 🤖. The original article can be found here. If you want to learn more about how this works, check out our repo.

In this article, the author discusses the concept of undefined behavior (UB) in the C++ programming language. The author mentions that they have been working on a project to enumerate the various forms of UB and explore their consequences. They plan to cover each UB in the order they appear in the C++ standard.

The article highlights the difference between undefined behavior and ill-formed no diagnostic required (IFNDR). While undefined behavior refers to runtime properties of a program, IFNDR is a static property that makes a program ill-formed but does not require the compiler to diagnose it.

The author specifically focuses on the lexer section of the C++ standard, which contains two cases of undefined behavior. However, they mention that these cases are expected to be removed in C++26. They provide an example of a line splice that results in a universal-character-name, which is currently considered undefined behavior but may be supported as well-formed in the future.

The article concludes by mentioning that the next undefined behavior in the lexer section is related to unterminated single or double quotes. The author suggests referring to the C++ standard for more details on this topic.

Developers interested in keeping up with the latest news and updates in the C++ programming language will find this article helpful in understanding and identifying undefined behavior in their code.