1 post tagged #conversions.
#conversions
Converting a float to an int is undefined behavior when the value does not fit, and for NaN. Nothing warns by default, and GCC and Clang produce different results for the same cast. Worse, GCC deliberately leaves the check out of -fsanitize=undefined, so you have to name float-cast-overflow to catch it.
// We use Google Analytics to understand which posts get traction and how the wro.cpp community grows. Anonymised, no ads, and you can decline -- the site works either way.