语句“(void)c;”的目的是什么? [英] What is the purpose of the statement "(void)c;"?

查看:176
本文介绍了语句“(void)c;”的目的是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于模糊的标题,对不起,但不是真的确定如何短语。所以我正在通过boost :: asio的内部(试图跟踪一些可笑的延迟),我注意到这样的代码虚线围绕:

Sorry for the vague title, but not really sure how to phrase it. So I was looking through the innards of boost::asio (trying to track down some ridiculous delays), and I notice code like this dotted about:

    op_queue<operation> completed_ops;
    task_cleanup c = { this, &lock, &completed_ops };
    (void)c;  // EH?

现在,从正在初始化的结构体名称开始,我猜是使用RAII一些破坏步骤 - 很好,但最后一行的目的是什么?

Now from the name of the struct that is being initialized, I'm guessing it's using RAII to do some steps on destruction - fine, but what is the purpose of the last line? Have I just missed something completely funky?

推荐答案

也许避免编译警告,因为 c 不使用?

Maybe to avoid a compilation warning because c isn't used?

这篇关于语句“(void)c;”的目的是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆