开发者

What is significance/use of doing void(param); at the start of function?

开发者 https://www.devze.com 2022-12-21 22:53 出处:网络
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),

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消