这个预编译的意思是什么?
else if (iid == IID_IY)
{
trace("Return inner component's IY interface.") ;
#if 1
// You can query for the interface.
return m_pUnknownInner->QueryInterface(iid,ppv) ; //@N
#else
// Or you can return a cached pointer.
*ppv = m_pIY ; //@N
// Fall through so it will get AddRef'ed
#endif
}
这个预编译的意义是什么?有什么用?
什么情况下会执行#if 1后面的代码,什么时候会执行#else后面的代码?
[解决办法]
预处理时,#if 0 与它对应的#endif之间的代码被忽略。
C语言经典注释/**/不允许嵌套,所以这是一种注释大段代码的方法。
也就是说#if 1 会一直执行的仅此而已。。