铸造函数返回无效 [英] Casting function returns to void
本文介绍了铸造函数返回无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
很多时候,我在开源$ C $ C的C函数的调用被转换为void看到的。
Many times I see in open source code that a call to a C function is cast to void.
例如,在源$ C $ C为 LS
(http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr /src/cmd/ls/ls.c)我看到以下内容。
For example, in the source code for ls
(http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/cmd/ls/ls.c) I see the following.
(void) setlocale(LC_ALL, "");
这是为什么好的做法呢?
Why is this good practice?
推荐答案
这明确意味着你忽略了返回值,不只是忘了。
It explicitly means you ignore the return value, and did not just forget it.
这篇关于铸造函数返回无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文