<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Apr 20, 2014, at 1:19 PM, Mark Rowe &lt;<a href="mailto:mrowe@apple.com">mrowe@apple.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div></div><br><div><br></div><div>Won’t compile:</div><div><br></div><div>if (!MAYBE_DEFINED) {</div><div>&nbsp; &nbsp; …</div><div>}</div><div><br></div><div>if (SOMETHING) {</div><div>&nbsp; &nbsp; void doSomething() { }</div><div>}</div><div><br></div><div>if (SOMETHING) {</div><div>&nbsp; &nbsp; #include “Something.h"</div><div>}</div><div><br></div><div><br></div><div>Will result in unintended behavior:</div><div><br></div><div>if (!FOO) {</div><div>&nbsp; &nbsp; …</div><div>#define BAR</div><div>&nbsp; &nbsp; …</div><div>}</div></div></blockquote><div><br></div>We clearly can’t use if() to replace #if in general. Let’s assume that we reject a universal proposal of that sort.</div><div><br></div><div>However, it seems like the above examples will generally not apply in the case of the switch for assertions being enabled or disabled. Or at least I would not expect it - do you know of such cases in the code?</div><div><br></div><div>One worry about Phil’s proposal is that we’d be making asserts enabled/disabled different from handling of other conditional preprocessor macros. One possible way to avoid this is to make asserts enabled/disabled a compile-time constant held in a const global variable instead. That would enforce this style and make it natural.</div><div><br></div><div>I am not sure offhand if this is actually viable, but I see no deep reason that assertion control has to be just like the conditional macros we use to avoid submitting code to the compiler that won’t actually compile.</div><div><br></div><div>Regards,</div><div>Maciej</div><div><br></div><div><br></div><br></body></html>