I see below code (with some omission):
int fwts_fault_catch(void);
int main(int argc, char **argv)
{
(void)fwts_fault_catch(); // <======== HERE
//...
}
So it seems the function invoking explicitly overrides the return type of the declared function prototype from int
to void
. Why doing this?
I did some test with below code:
int func1(void){
return 1;
}
int main(int argc, char** argv){
func1(); // line 2
(void)func1(); // line 1
}
I check the assembly code generated with gcc for line 1 and 2 respectively. But there's no difference.
So, what's the (void)
for?