Hidden benefits of undefined behavior

2025-10-17 Hidden benefits of undefined behavior I was reviewing some code at work, and something jumped at me when reading some arithmetic: static inline int64_t int32ToDecimal9 ( int32_t i ) { return i * 1000000000 ; } If you’ve had the good fortune of dealing with C or C++ for extended periods you would have recognized the problem. i * 1000000000 will be performed with 32-bit precision, which…