Everything in C is undefined behavior
Scored daily by a customisable AI persona to surface the most relevant engineering leadership news.
Deep dive on undefined behavior in C, high community engagement but not core interest.
All nontrivial C and C++ code contains undefined behavior (UB), making correct programs impossible, argues a veteran developer. UB includes subtle cases like misaligned pointer access (C23 6.3.2.3) — safe on x86 but deadly on SPARC or Alpha — and compilers assume such UB never occurs, even without optimizations. This 'telephone game' means code that works today may break on future architectures or compiler versions.
- Evaluate Rust or Go for any new systems-level code that replaces C/C++ to avoid undefined behavior and future-proof your infrastructure.
For a platform/solutions architect, this reinforces the argument for adopting memory-safe languages like Rust or Go in new systems programming to eliminate UB risks that threaten reliability and security at scale.