tags:

views:

111

answers:

1

Hi All, 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;                                                                                                          
  (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

+7  A: 

This suppresses the "unused argument" warnings. Those statements do nothing, but count as using the argument.

UncleBens
Oh yes..Thanks for quick answer
Prafulla