铸造在编译器/机器级别做什么? [英] What does casting do at compiler/machine level?

查看:152
本文介绍了铸造在编译器/机器级别做什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我经常想知道浇铸在编译器或机器级别究竟是什么。它对内存中的0和1有什么作用?

I have often wondered what exactly does casting do at compiler or machine level. What does it do with the 0 and 1s in memory?

任何人都可以指点一些好的文学。

Can anyone point me at some good literature.

推荐答案

转换不会在引用类型之间转换时修改单个位,它只是指示编译器/运行时尽可能以特定方式解释位。

Casting doesn't modify the individual bits when casting between reference types, it just instructs the compiler/runtime to interpret the bits in a specific way if possible.

如果由于不兼容类型在编译时不能进行强制转换,则会发出错误。如果在运行时不可能转换,则抛出异常。

If the cast is not possible at compile time due to incompatible types an error is issued. If the cast is not possible at runtime an exception is thrown.

关于类型转换的wiki页面有其他信息。

这篇关于铸造在编译器/机器级别做什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆