Don't use static cast for arithmetic conversions (cpp-core-guidelines)
问题 msvc's code analyzer for the cpp core guidelines tells me Warning C26472 Don't use a static_cast for arithmetic conversions. Use brace initialization, gsl::narrow_cast or gsl::narrow (type.1). for this snippet static_cast<IntType>(static_cast<unsigned long long>(hexValue(digit)) << (digitIdx * 4)); Why shouldn't I use static_cast here? Also, with brace init this would look like this IntType{unsigned long long{hexValue(digit)} << (digitIdx * 4)}; which doesn't look any better imo. This looks