cpp_weekly
cpp_weekly copied to clipboard
Integer conversion best practices.
Channel
"C++Weekly" episode request
Topics
Ok, auto conversion between integer types is evil. Got it. We need to get our tools to help us find silent conversions. Got that. So when you absolutely have to do a narrowing or signed conversion (size_t to int, or int64_t to int32_t, what are some best practices? gsl::narrow boost::numeric_cast static_cast have faith that we will dodge overflow, underflow, and sign extension bugs something else
Our code base has accumulated examples of all of these. Yuk.
Length
bite-sized (5-10 minutes)?