"Cast to void " is a C idiom that, by convention, suppresses the compiler and lint warnings about unused variables or return values.
In this case, as Dietrich Epp correctly points out, he tells the compiler that you know that you are not using the p argument, but are not warning you about “unused arguments”.
Another use of this idiom that converts the return value of a function to void is the traditional way of telling lint or, more importantly, other programmers that you have made the conscious decision not to worry about checking the return value of the function. For example:
(void)printf("foo")
It will mean that "I know that printf() returns a value, and I really have to check it, but I decided not to bother."
Emmet
source share