Many times I see in open source code that a call to a C function is cast to void.
For example, in the source code for ls (http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr开发者_Python百科/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.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论