c++ - *cast* 和 *conversion* 是什么意思?

标签 c++ casting terminology

<分区>

Possible Duplicate:
Is there any difference between type casting & type conversion?

我个人交替使用术语castconversion。那是对的吗?如果不是,有什么区别?

最佳答案

我不认为它们是相同的——强制转换导致编译器执行显式转换,但您也可以进行隐式转换,例如

double d = 23; // implicit conversion from int to double

对比:

int i = static_cast<int>(23.0); // explicit conversion from double to int

关于c++ - *cast* 和 *conversion* 是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4167407/

相关文章:

php - 在 PHP 中将字符串转换为 long int 的正确方法

terminology - 无状态与有状态

c++ - a>?=b 是什么意思?

c++ - 为长值数组重载 operator<

c++ - 如何在 C/C++ 代码中生成编译器警告 "statement has no effect"

swift - Swift 中的隐式类型转换

c++ - 检测到 'vccorlib_lib_should_be_specified_before_msvcrt_lib_to_linker' : value '1' doesn't match value '0' in msvcrtd. 库不匹配

php - (size_t)(uint32_t)-(int32_t)(nTableMask) 是什么意思

MySQL 和 SQL Server 术语

ruby - "k.send :hello"- 如果 k 是 "receiver",谁是发件人?