What is significance/use of doing void(param); at the start of function?
I was just going thro' source code of Yahoo's Trafic Server It is written in C++.
In almost all methods (from one of modules), they do void(param) on each param that function receive.
(Eg below)Can someone explain what this could be for ?
int
some_method_name(caddr_t addr, size_t len, caddr_t end,
int flags)
{
(void) end;
(void) addr; 开发者_Go百科
(void) len;
(void) end;
(void) flags;
......
....
}
PS: For actual source code, please see methods from http://github.com/apache/trafficserver/blob/trunk/iocore/eventsystem/SocketManager.cc
This suppresses the "unused argument" warnings. Those statements do nothing, but count as using the argument.
精彩评论