Re: Preceding a method call with (void)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 10 Sep 2015 07:52:49 +0300, Kevin Wilson said:

> (void) myFunc(param1);
>
> I did not encounter such cases in the kernel code that I read, thus far.
>
> On the other hand, I did not saw in the kernel coding style doc
> anything which prohibits such usage.
>
> If I remember, using (void) before the method name is a way to tell
> explicitly that this method does not return any value,
> but I am not sure as for the exact reasons it is used (in userspace).

Well, if the function actually returns nothing, in kernel code we usually
declare it as:

void myFunc( int param1)
{
/* yadda yadda yadda *.
}

Given that, what reason is there for casting the return value with (void)?

(And if the function is actually   'int myFunc ( int param1) {...}',
why are you calling it and then ignoring the return value?  That's a clue
that you're abusing the API...)

Attachment: pgplLo2xnifnl.pgp
Description: PGP signature

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux