c - Need for prefixing a function with (void) -


I recently came across an unusual coding conference in which "zero" returning function with a call (zero) Was prefixed.

For example

  (zero) my function ();  

Is it different from the function call:

  My Function ();  

Does this have any advantage or is it not a requirement, but to codify any kind of conference?

Some functions, such as printf () return a value that is not used in the actual code ( In the case of printf, number of printed characters). However, some devices, such as Lint , expect that if a function returns a value, it should be used and compliant as long as you write something like this:

  int n = Printf ("hello");  

Use of zero cast:

  (zero) printf ("hello");  

There is a way to tell such tools that you do not really want to use the return value, thus keeping them quiet if you do not use such devices, you get annoyed There is no need to do so, and in most cases, most tools allow you to configure them to ignore return values ​​from a specific function.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -