Undefined Behavior in C and C++

russellw.github.io
undefined-behavior-in-c-and-c++

February 3, 2024 Photo by Jonathan Kemper on Unsplash Working in C or C++ requires some awareness of undefined behavior: what it is, what its effects are, and how to avoid tripping over it. For simplicity, I will just talk … Read more

GCC undefined behaviors are getting wild

blog.pkh.me

Happy with my recent breakthrough in understanding C integer divisions after weeks of struggle, I was minding my own business having fun writing integer arithmetic code. Life was good, when suddenly… zsh: segmentation fault (core dumped). That code wasn’t messing … Read more

Undefined Isn’t Unpredictable

os2museum.com
undefined-isn’t-unpredictable

The other day I discovered that 32-bit FreeBSD 11.2 has strange trouble running in an emulated environment. Utilities like ping or top would just hang when trying to print floating-point numbers through printf(). The dtoa() library routine was getting stuck … Read more

Undefined behavior in C is a reading error

yodaiken.com
undefined-behavior-in-c-is-a-reading-error

Considering how important “undefined behavior” has become to C semantics and the ISO/IEC JTC1/SC22/WG14 Committee, the lack of any reference to it in the K&R ANSI book is notable and the description in the 1999 C Rationale was quite modest. … Read more