• <tfoot id='euOcW'></tfoot>

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

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

        • <bdo id='euOcW'></bdo><ul id='euOcW'></ul>
      1. <legend id='euOcW'><style id='euOcW'><dir id='euOcW'><q id='euOcW'></q></dir></style></legend>

        有没有一种干净的方法来防止 windows.h 创建一个接

        时间:2023-08-01

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

            <tbody id='vacGm'></tbody>
          • <small id='vacGm'></small><noframes id='vacGm'>

            <tfoot id='vacGm'></tfoot>
                <legend id='vacGm'><style id='vacGm'><dir id='vacGm'><q id='vacGm'></q></dir></style></legend>
                1. <i id='vacGm'><tr id='vacGm'><dt id='vacGm'><q id='vacGm'><span id='vacGm'><b id='vacGm'><form id='vacGm'><ins id='vacGm'></ins><ul id='vacGm'></ul><sub id='vacGm'></sub></form><legend id='vacGm'></legend><bdo id='vacGm'><pre id='vacGm'><center id='vacGm'></center></pre></bdo></b><th id='vacGm'></th></span></q></dt></tr></i><div id='vacGm'><tfoot id='vacGm'></tfoot><dl id='vacGm'><fieldset id='vacGm'></fieldset></dl></div>

                  本文介绍了有没有一种干净的方法来防止 windows.h 创建一个接近 &amp;远宏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  在 WinDef.h 的深处有一个来自分段内存时代的遗物:

                  Deep down in WinDef.h there's this relic from the segmented memory era:

                  #define far
                  #define near
                  

                  如果您尝试使用near 或far 作为变量名,这显然会导致问题.任何干净的解决方法?其他然后重命名我的变量?

                  This obviously causes problems if you attempt to use near or far as variable names. Any clean workarounds? Other then renaming my variables?

                  推荐答案

                  您可以安全地取消定义它们,这与其他人的声明相反.原因是它们只是宏的.它们只影响定义和未定义之间的预处理器.在您的情况下,这将从 windows.h 的早期到 windows.h 的最后一行.如果您需要额外的窗口标题,您可以将它们包含在 windows.h 之后和 #undef 之前.在您的代码中,预处理器将按照预期简单地保持符号不变.

                  You can safely undefine them, contrary to claims from others. The reason is that they're just macros's. They only affect the preprocessor between their definition and their undefinition. In your case, that will be from early in windows.h to the last line of windows.h. If you need extra windows headers, you'd include them after windows.h and before the #undef. In your code, the preprocessor will simply leave the symbols unchanged, as intended.

                  关于旧代码的注释是无关紧要的.该代码将在一个单独的库中,独立编译.只有在链接时才会连接这些宏,而宏早已不复存在.

                  The comment about older code is irrelevant. That code will be in a separate library, compiled independently. Only at link time will these be connected, when macros are long gone.

                  这篇关于有没有一种干净的方法来防止 windows.h 创建一个接近 &amp;远宏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:错误:无法在赋值中将“const wchar_t [13]"转换为 下一篇:“APIENTRY _tWinMain"和“WINAPI WinMain"不同之处

                  相关文章

                  最新文章

                  <legend id='yZlrj'><style id='yZlrj'><dir id='yZlrj'><q id='yZlrj'></q></dir></style></legend>
                2. <tfoot id='yZlrj'></tfoot>

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