什么时候在C ++中进行强制转换,编译时或运行时?

时间:2019-04-29 06:28:14

标签: c++ casting

c ++隐式强制转换/转换是在编译时还是在运行时发生?

int64 i64 = 1;
int8 i8 = static_cast<int8>(i64); // (1) explicit cast, when does this happen?
int32 i32 = i8; // (2) implicit cast,when does this happen?

重复 该问题与其他问题重复,请参阅以下内容:

[1] Do constant and reinterpret cast happen at compile time?

[2] Is static_cast<T>(...) compile-time or run-time?

0 个答案:

没有答案