cpp_weekly icon indicating copy to clipboard operation
cpp_weekly copied to clipboard

Integer conversion best practices.

Open bleppard opened this issue 1 year ago • 0 comments

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)?

bleppard avatar Apr 25 '24 23:04 bleppard