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

      <legend id='vRv4j'><style id='vRv4j'><dir id='vRv4j'><q id='vRv4j'></q></dir></style></legend>

      • <bdo id='vRv4j'></bdo><ul id='vRv4j'></ul>

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

      1. MSVC -Wall 标准标题中的数千条警告是怎么回事?

        时间:2023-10-06

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

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

              <bdo id='WV8r0'></bdo><ul id='WV8r0'></ul>
              1. <tfoot id='WV8r0'></tfoot>

                  <legend id='WV8r0'><style id='WV8r0'><dir id='WV8r0'><q id='WV8r0'></q></dir></style></legend>

                  本文介绍了MSVC -Wall 标准标题中的数千条警告是怎么回事?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  有些人似乎建议您使用 -Wall,但是当我在一个只有 main.cpp 和一些包含的小型测试项目中这样做时,我收到了 5800 条警告,其中大部分在标准标题或 Windows 标题中.

                  Some people seem to advise you use -Wall, but when I did it on a small test project which just has a main.cpp with some includes, I get 5800 warnings most of them in standard headers or in windows headers.

                  这是预期的行为吗?如何让我的编译警告免费?

                  Is that intended behaviour? How do I go about making my compilation warning free?

                  这里只是一些阅读乐趣:

                  Here are just a few for some reading fun:

                  1>c:program filesmicrosoft visual studio 10.0vcincludestdint.h(105): warning C4668: '_INTPTR' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
                  1>c:program filesmicrosoft visual studio 10.0vcincludewchar.h(109): warning C4820: '_wfinddata64i32_t' : '4' bytes padding added after data member '_wfinddata64i32_t::attrib'
                  1>c:program filesmicrosoft visual studio 10.0vcincludewchar.h(114): warning C4820: '_wfinddata64i32_t' : '4' bytes padding added after data member '_wfinddata64i32_t::name'
                  1>c:program filesmicrosoft visual studio 10.0vcincludewchar.h(118): warning C4820: '_wfinddata64_t' : '4' bytes padding added after data member '_wfinddata64_t::attrib'
                  1>c:program filesmicrosoft visual studio 10.0vcincludewchar.h(488): warning C4820: '_stat32' : '2' bytes padding added after data member '_stat32::st_gid'
                  1>c:program filesmicrosoft visual studio 10.0vcincludewchar.h(504): warning C4820: 'stat' : '2' bytes padding added after data member 'stat::st_gid'
                  1>c:program filesmicrosoft visual studio 10.0vcincludewchar.h(520): warning C4820: '_stat32i64' : '2' bytes padding added after data member '_stat32i64::st_gid'
                  1>c:program filesmicrosoft visual studio 10.0vcincludewchar.h(521): warning C4820: '_stat32i64' : '4' bytes padding added after data member '_stat32i64::st_rdev'
                  1>c:program filesmicrosoft visual studio 10.0vcincludewchar.h(525): warning C4820: '_stat32i64' : '4' bytes padding added after data member '_stat32i64::st_ctime'
                  1>c:program filesmicrosoft visual studio 10.0vcincludewchar.h(534): warning C4820: '_stat64i32' : '2' bytes padding added after data member '_stat64i32::st_gid'
                  1>c:program filesmicrosoft visual studio 10.0vcincludewchar.h(548): warning C4820: '_stat64' : '2' bytes padding added after data member '_stat64::st_gid'
                  1>c:program filesmicrosoft visual studio 10.0vcincludewchar.h(549): warning C4820: '_stat64' : '4' bytes padding added after data member '_stat64::st_rdev'
                  1>c:program filesmicrosoft visual studio 10.0vcincludecrtdbg.h(1078): warning C4986: 'operator new[]': exception specification does not match previous declaration
                  1>          c:program filesmicrosoft visual studio 10.0vcinclude
                  ew(79) : see declaration of 'operator new[]'
                  1>c:program filesmicrosoft visual studio 10.0vcincludecrtdbg.h(1095): warning C4986: 'operator delete[]': exception specification does not match previous declaration
                  1>          c:program filesmicrosoft visual studio 10.0vcinclude
                  ew(77) : see declaration of 'operator delete[]'
                  1>c:program filesmicrosoft visual studio 10.0vcinclude	ypeinfo(76): warning C4820: 'type_info' : '3' bytes padding added after data member 'type_info::_M_d_name'
                  1>c:program filesmicrosoft sdkswindowsv7.0aincludeasetsd.h(114): warning C4668: '__midl' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
                  1>c:program filesmicrosoft sdkswindowsv7.0aincludewinnt.h(8154): warning C4820: '_SECURITY_QUALITY_OF_SERVICE' : '2' bytes padding added after data member '_SECURITY_QUALITY_OF_SERVICE::EffectiveOnly'
                  1>c:program filesmicrosoft sdkswindowsv7.0aincludewinnt.h(8165): warning C4820: '_SE_IMPERSONATION_STATE' : '2' bytes padding added after data member '_SE_IMPERSONATION_STATE::EffectiveOnly'
                  1>c:program filesmicrosoft sdkswindowsv7.0aincludewinnt.h(8334): warning C4820: '_QUOTA_LIMITS' : '4' bytes padding added after data member '_QUOTA_LIMITS::PagefileLimit'
                  1>c:program filesmicrosoft sdkswindowsv7.0aincludewinnt.h(8357): warning C4820: '_QUOTA_LIMITS_EX' : '4' bytes padding added after data member '_QUOTA_LIMITS_EX::PagefileLimit'
                  1>c:program filesmicrosoft sdkswindowsv7.0aincludewinnt.h(8405): warning C4820: '_JOBOBJECT_BASIC_LIMIT_INFORMATION' : '4' bytes padding added after data member '_JOBOBJECT_BASIC_LIMIT_INFORMATION::SchedulingClass'
                  1>c:program filesmicrosoft sdkswindowsv7.0aincludewinnt.h(8984): warning C4820: '_FILE_NOTIFY_INFORMATION' : '2' bytes padding added after data member '_FILE_NOTIFY_INFORMATION::FileName'
                  1>c:program filesmicrosoft sdkswindowsv7.0aincludewinnt.h(9012): warning C4820: '_REPARSE_GUID_DATA_BUFFER' : '3' bytes padding added after data member '_REPARSE_GUID_DATA_BUFFER::GenericReparseBuffer'
                  1>c:program filesmicrosoft sdkswindowsv7.0aincludewinnt.h(10131): warning C4820: '<unnamed-tag>' : '3' bytes padding added after data member '<unnamed-tag>::Data'
                  1>c:program filesmicrosoft sdkswindowsv7.0aincludewinnt.h(10241): warning C4820: '<unnamed-tag>' : '4' bytes padding added after data member '<unnamed-tag>::DecreaseTime'
                  1>c:program filesmicrosoft sdkswindowsv7.0aincludewinnt.h(10262): warning C4820: '<unnamed-tag>' : '4' bytes padding added after data member '<unnamed-tag>::TimerInterval' 
                  1>c:program filesmicrosoft sdkswindowsv7.0aincludewincrypt.h(1440): warning C4668: 'NTDDI_WINLH' is not defined as a preprocessor macro, replacing with '0' for '#if/
                  

                  推荐答案

                  Visual C++ /Wall 启用所有在 /W4 处默认禁用的警告.正如您所发现的,默认情况下禁用许多这些警告是有充分理由的(感谢编译器告诉我您添加了填充;我真的很感激!).最好在 Visual C++ 上使用 /W4.

                  The Visual C++ /Wall enables all of the warnings that are disabled by default at /W4. As you've found out, there is a good reason why a lot of those warnings are disabled by default (thanks, compiler, for telling me you've added padding; I really appreciate it!). It's probably best just to use /W4 on Visual C++.

                  Intel C++ 也是这样(我不知道其他使用 EDG 前端的编译器).如果您将其设置为 /W5,它会发出大量信息性消息.我个人最喜欢的是,如果存储类说明符不在声明的开头,它会警告您(因此,const static int 不行,但 static const int没问题).

                  Intel C++ is like this too (I don't know about other compilers that utilize the EDG frontend). If you set it at /W5, it spews out tons of informational messages. My personal favorite is that it warns you if the storage class specifier isn't at the beginning of a declaration (so, const static int is no go, but static const int is fine).

                  这篇关于MSVC -Wall 标准标题中的数千条警告是怎么回事?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何在 C++ 中将窗口的屏幕截图作为位图对象获取 下一篇:为什么 VS 不为逻辑运算符定义替代标记?

                  相关文章

                  最新文章

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

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