Why should a return type be specified for a function when it is called in C?

Possible duplicate:
Need for prefixing a function with (void) ...

Hi,

I work with some C code, and the author used syntax that I am not familiar with. At the next function call:

(void) msleep(&gActivationCount, NULL, PUSER,
    "com_apple_dts_kext_KauthORama.RemoveListener", &oneSecond);

It seems that the author is throwing a return to the void or simply indicating that it will probably be in the prototype of the function (I say, probably because I cannot allow this function to the prototype), says for the return value. Isn't that equivalent:

msleep(&gActivationCount, NULL, PUSER,
    com_apple_dts_kext_KauthORama.RemoveListener", &oneSecond);

Thank,

Scott

+3
source share
2 answers

( ) , , lint , . , - . , (, gcc) , .

+4

, , (, , !)

void, (void).

, , - __attribute__((warn_unused_result)), , .

+3

Source: https://habr.com/ru/post/1777782/


All Articles