Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
将 int 转换为 uint32_t 时使用的最佳转换方法是什么?
我应该使用(uint32_t)num, or reinterpret_cast<uint32_t>(num), orstatic_cast<uint32_t>(num)吗?(或者是其他东西)?
(uint32_t)num
reinterpret_cast<uint32_t>(num)
static_cast<uint32_t>(num)
我知道关于不同的转换类型有很多解释,但我想具体询问原始类型。