I understand another's code and came across the following:
CClientHandler* handler = new CClientHandler(sock, b); (void)handler; What does (void) before the handler pointer?
I understand another's code and came across the following:
CClientHandler* handler = new CClientHandler(sock, b); (void)handler; What does (void) before the handler pointer?
View strings
(void)handler; or
handler; commonly used to get rid of the "Variable ... not used" compiler warnings. If further on the code the pointer is used, then this line can be deleted.
https://stackoverflow.com/questions/21045615/what-does-voidvar-actually-do
expression result unused . - αλεχολυτThe easiest way to find out is to comment out the given line and compile it. If further in the text of the function there is no mention of handler , then the exception of the string (void)handler; would result in a warning about an unused variable (at the appropriate compiler alert level) (which is already mentioned in the @goldstar_labs answer).
However, in the situation mentioned, one could simply reduce the code to the following form:
new CClientHandler(sock, b); this somehow saved for later deletion. - αλεχολυτSource: https://ru.stackoverflow.com/questions/531901/
All Articles