我今天注意到项目中的源代码文件正在编译,即使它顶部有垃圾.它让我想知道通过编译器会通过什么都没有错误.以下是不会生成任何错误消息的代码示例:
what kind of weird behaviour is this???
#include "stdafx.h"
// what is up?
int foo(int bar)
{
bla bla bla?????
return bar;
}
and more junk???
Run Code Online (Sandbox Code Playgroud)
编译器在世界上做了什么来允许编译代码而不给出任何错误消息?我正在使用Visual Studio 2008,这是非托管的C++代码.foo函数实际上并不在目标文件中生成,因此无法使用,但为什么没有错误?