disable4786.h

来自「游戏开发人工智能技术-AI.Techniques.for.Game.Progra」· C头文件 代码 · 共 30 行

H
30
字号
#pragma warning(disable:4786)
// http://support.microsoft.com/support/kb/articles/Q167/3/55.ASP
// states that yes, it's a compiler bug that
// #pragma warning(disable: 4786) doesn't always work.

// They don't, however, list a workaround.

// I found that, very strangely, #including <iostream> made the
// remaining 4786 warnings go away!

// Of course, #including <iostream> is inefficient and
// slows compilation - so I whittled away most of what's in
// <iostream> and discovered that the "active ingredient" in
// <iostream> appears to be a declaration of a static class,
// complete with default constructor.

// For some reason, this works around the bug!
// Why does this work? Beats me, ask those smart guys at MS who
// wrote the compiler.

class msVC6_4786WorkAround {
public:
     msVC6_4786WorkAround() {}
     };

static msVC6_4786WorkAround
WowIWonderWhatCrapCodeMustBeInTheCompilerToMakeThisWorkaroundWork;

// End of File

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?