Everything in C is undefined behavior
The article discusses the pervasive issue of undefined behavior (UB) in C and C++ programming languages. It argues that UB is a fundamental problem that affects all nontrivial code, making it difficult for programmers to write correct software. The author emphasizes that UB can lead to unpredictable results, regardless of whether optimizations are enabled during compilation.
- ▪Undefined behavior is a significant issue in C and C++ programming, affecting all nontrivial code.
- ▪Common examples of UB include accessing uninitialized memory and double-free errors.
- ▪The author argues that UB is everywhere, and it is unfair to solely blame programmers for these issues.
Opening excerpt (first ~120 words) tap to expand
This is my personal blog. The views expressed on these pages are mine alone and not those of my employer. This is not AI. All hallucinations are my own human ones. Everything in C is undefined behavior 2026-05-19, Categories: programming, security If he had been a programmer, Cardinal Richelieu would have said “Give me six lines written by the hand of the most expert C programmer in the world, and I will find enough in them to trigger undefined behavior”. Nobody can write correct C, or C++. And I say that as someone who’s written C and C++ on an almost daily basis for about 30 years. I listen to C++ podcasts. I watch C++ conference talks. I enjoy reading and writing C++. C++ has served us well, but it’s 2026, and the environment of 1985 (C++) or 1972 (C) is not the environment of today.
…
Excerpt limited to ~120 words for fair-use compliance. The full article is at Habets.