WXUNUSED的作用

 

WXUNUSED is a macro you'll use for the wxEvent parameter of a hollow event handler to make some compilers not to complain about unused parameters. This simple concept used to appear sometimes a problem for beginners because it seems to have been never explained anywhere openly before.

Usage example

void MyFrame::OnExit( wxEvent& WXUNUSED(event) )
{
// Do Something
}
 
 
another article qutoed as the following:
  
  
In many examples I have noted that the event methods are declared like:
void OnEvent(wxCommandEvent& WXUNUSED(event));

What does WXUNUSED do?
As I understand it, it's a way to prevent the compiler from issuing
"unused parameter" warnings when you write a function that's called
from the EVENT_TABLE, but don't use the event parameter..

[ciach]
void frm::btnquit_click(wxCommandEvent & WXUNUSED(event)){
        Destroy();
}

And the compiler won't complain :)
The compiler won't complain if you do:

void frm::btnquit_click(wxCommandEvent & ) {
....
};

(at least gcc won't complain)

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值