真的有关#ifdef _DEBUG的新手问题 [英] Really newbie question about #ifdef _DEBUG

查看:306
本文介绍了真的有关#ifdef _DEBUG的新手问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,





Ok,


#ifdef _DEBUG

SuperSecretVariable = 0;

#endif





SuperSecretVariable = 0;在发布版本中以任何方式存在,假设在发布配置中未定义_DEBUG?或者换句话说它是相当于注释掉的代码?



谢谢。



:Mor -Ron



Will SuperSecretVariable = 0; exist in any way in the release build assuming _DEBUG is not defined in the release configuration? Or in other words is it the equivalent of commented-out code?

Thanks.

:Mor-Ron

推荐答案

#ifdef是一个预处理程序指令 - 这意味着它在源代码传递给实际编译器之前被处理,而#if(以及所有其他然后处理#directives)并在那里进行源代码替换。

因此,如果测试失败,代码永远不会传递到任何地方,因此不能出现在最终输出中任何形式。
#ifdef is a preprocessor directive - which means it is processed before your source code is passed to the actual compiler, and the #if (and all other #directives) are handled then and there and the substitutions made in the source at that point.
So if the test fails, the code is never passed anywhere and thus can't appear in the final output in any form.


你寻求的答案是否定的,是的



(假设没有其他你定义的地方' SuperSecretVariable')



'g'
the answers you seek are no, and yes

(assuming there's no other place you've defined 'SuperSecretVariable' )

'g'


这篇关于真的有关#ifdef _DEBUG的新手问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆