Using iPhone/Objective C CGFloats: Is 0.1 okay, or should it be 0.1f?

[亡魂溺海] 提交于 2019-12-02 06:28:41

It's not important; it won't break anything to use a double-precision constant where a single-precision constant is expected.

However, if you have turned on the warning about implicit 64-bit-to-32-bit conversions and are building for 32-bit architectures (which I believe includes the iPhone), then you'll want to use single-precision constants simply to avoid getting that warning.

(Alternatively, you could set that setting to explicitly off, with an architecture condition turning it on for 64-bit architectures. But that currently only matters if you're also using some of your code in a Mac application.)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!