V2EX  ›  英汉词典

Explicit Cast

释义 Definition

explicit cast显式类型转换(在编程中,开发者用明确的语法把一个值从一种数据类型转换为另一种数据类型,通常用于避免隐式转换带来的歧义或错误)。在不同语言里常见形式包括 C/C++ 的 (type)value、C# 的 (type)value、Java 的 (Type) value 等。

例句 Examples

I used an explicit cast to convert the float to an int.
我用了显式类型转换,把浮点数转换成整数。

Without an explicit cast, the compiler warns that converting a large integer to a smaller type may lose data.
如果不进行显式类型转换,编译器会警告把大整数转换成更小的类型可能会丢失数据。

发音 Pronunciation (IPA)

/ɪkˈsplɪsɪt kɑːst/

词源 Etymology

explicit 来自拉丁语 explicitus,含义与“清楚展开、明确说明”相关;cast 在此并非“投掷/演员”,而是计算机领域的用法,指“把(数据)塑造成另一种类型”。合起来 explicit cast 就是“需要明确写出来的类型转换”。

相关词 Related Words

文学与作品 Literary Works

  • The C Programming Language(Kernighan & Ritchie):讨论 C 语言中的强制类型转换(cast),包括需要显式写出的转换形式。
  • C++ Primer(Lippman, Lajoie, Moo):讲解 C++ 的类型转换与显式转换(含 C 风格 cast 与 static_cast 等)。
  • *Effective C++*(Scott Meyers):强调在 C++ 中谨慎使用显式转换,并介绍更安全、更明确的转换写法。
关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   831 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 12ms · UTC 18:47 · PVG 02:47 · LAX 10:47 · JFK 13:47
♥ Do have faith in what you're doing.