What is the meaning / use of execution void (param); at the beginning of the function?

I just started reading the source code of Yahoo Trafic Server. It is written in C ++.

In almost all methods (from one of the modules) they do void (param) for each parameter that the function receives.
(E.g. below)

Can someone explain what this might be for?

int                                                                                                                                                                     
some_method_name(caddr_t addr, size_t len, caddr_t end, 
 int flags)
{  
  (void) end;                                                                                                                                                
  (void) addr;                                                                                                          
  (void) len;                                                                                                                                                   
  (void) end;                                                                                                                                               
  (void) flags;  
  ......
  ....
}

PS: For the actual source code, see Methods from http://github.com/apache/trafficserver/blob/trunk/iocore/eventsystem/SocketManager.cc

+5
source share
1 answer

This suppresses the "unused argument" warnings. These statements do nothing, but are counted using the argument.

+8
source

All Articles