From Jason Turner
Watch on YouTube

Summary

This episode reveals a subtle but important issue where calling unqualified abs() on floating-point values in C++ can silently truncate to integer values due to ambiguity between C and C++ standard library implementations. Jason demonstrates that including should theoretically provide only the std:: namespace versions, but surprising behavior can occur depending on implementation details. The consistent solution is to always use the fully qualified std::abs() form to ensure the proper overload is selected based on argument type.

Resources

Tags