<legend id='0Hcx2'><style id='0Hcx2'><dir id='0Hcx2'><q id='0Hcx2'></q></dir></style></legend>
      • <bdo id='0Hcx2'></bdo><ul id='0Hcx2'></ul>

      <small id='0Hcx2'></small><noframes id='0Hcx2'>

      <i id='0Hcx2'><tr id='0Hcx2'><dt id='0Hcx2'><q id='0Hcx2'><span id='0Hcx2'><b id='0Hcx2'><form id='0Hcx2'><ins id='0Hcx2'></ins><ul id='0Hcx2'></ul><sub id='0Hcx2'></sub></form><legend id='0Hcx2'></legend><bdo id='0Hcx2'><pre id='0Hcx2'><center id='0Hcx2'></center></pre></bdo></b><th id='0Hcx2'></th></span></q></dt></tr></i><div id='0Hcx2'><tfoot id='0Hcx2'></tfoot><dl id='0Hcx2'><fieldset id='0Hcx2'></fieldset></dl></div>
      <tfoot id='0Hcx2'></tfoot>

    1. MSVC 相当于 __attribute__ ((warn_unused_result))?

      时间:2023-10-05
    2. <small id='mQ6ak'></small><noframes id='mQ6ak'>

          <bdo id='mQ6ak'></bdo><ul id='mQ6ak'></ul>

                <tbody id='mQ6ak'></tbody>
              • <i id='mQ6ak'><tr id='mQ6ak'><dt id='mQ6ak'><q id='mQ6ak'><span id='mQ6ak'><b id='mQ6ak'><form id='mQ6ak'><ins id='mQ6ak'></ins><ul id='mQ6ak'></ul><sub id='mQ6ak'></sub></form><legend id='mQ6ak'></legend><bdo id='mQ6ak'><pre id='mQ6ak'><center id='mQ6ak'></center></pre></bdo></b><th id='mQ6ak'></th></span></q></dt></tr></i><div id='mQ6ak'><tfoot id='mQ6ak'></tfoot><dl id='mQ6ak'><fieldset id='mQ6ak'></fieldset></dl></div>

                <legend id='mQ6ak'><style id='mQ6ak'><dir id='mQ6ak'><q id='mQ6ak'></q></dir></style></legend>
              • <tfoot id='mQ6ak'></tfoot>
                本文介绍了MSVC 相当于 __attribute__ ((warn_unused_result))?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我发现 __attribute__ ((warn_unused_result)) 作为一种鼓励开发人员不要忽略函数返回的错误代码的方法非常有用,但我需要它与 MSVC 一起工作,以及gcc 和 gcc 兼容的编译器,例如 ICC.Microsoft Visual Studio C/C++ 编译器是否具有等效机制?(到目前为止,我已经尝试在 MSDN 中涉水但没有任何运气.)

                I'm finding __attribute__ ((warn_unused_result)) to be very useful as a means of encouraging developers not to ignore error codes returned by functions, but I need this to work with MSVC as well as gcc and gcc-compatible compilers such as ICC. Do the Microsoft Visual Studio C/C++ compilers have an equivalent mechanism ? (I've tried wading through MSDN without any luck so far.)

                推荐答案

                它是 _Check_return_.有关类似注释和 此处 了解函数行为.自 MSVC 2012 起支持.

                It's _Check_return_. See here for examples of similar annotations and here for function behaviour. It's supported since MSVC 2012.

                示例:

                _Check_return_
                int my_return_must_be_checked() {
                    return 42;
                }
                

                这篇关于MSVC 相当于 __attribute__ ((warn_unused_result))?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:错误请#define _AFXDLL 或不使用/MD[d] 即使在项目属性 下一篇:在代码优化期间,C++11 编译器是否会将局部变量

                相关文章

                最新文章

                <tfoot id='rWtuQ'></tfoot>

                <small id='rWtuQ'></small><noframes id='rWtuQ'>

                • <bdo id='rWtuQ'></bdo><ul id='rWtuQ'></ul>
                <legend id='rWtuQ'><style id='rWtuQ'><dir id='rWtuQ'><q id='rWtuQ'></q></dir></style></legend>

              • <i id='rWtuQ'><tr id='rWtuQ'><dt id='rWtuQ'><q id='rWtuQ'><span id='rWtuQ'><b id='rWtuQ'><form id='rWtuQ'><ins id='rWtuQ'></ins><ul id='rWtuQ'></ul><sub id='rWtuQ'></sub></form><legend id='rWtuQ'></legend><bdo id='rWtuQ'><pre id='rWtuQ'><center id='rWtuQ'></center></pre></bdo></b><th id='rWtuQ'></th></span></q></dt></tr></i><div id='rWtuQ'><tfoot id='rWtuQ'></tfoot><dl id='rWtuQ'><fieldset id='rWtuQ'></fieldset></dl></div>