<html><head><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:32 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><br></div></div><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;">It’s also not possible to determine from context alone whether #if or if should be used. When #if is used to remove members or functions you’re then forced to use #if, rather than if, around all uses of those members or functions since the alternative won’t compile.</div><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;"><br></div><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;">An example lifted from Vector.h:</div><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;"><br></div><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>#if !ASSERT_DISABLED</div><div>template&lt;typename T&gt; struct ValueCheck&lt;Vector&lt;T&gt;&gt; {</div><div>&nbsp; &nbsp; typedef Vector&lt;T&gt; TraitType;</div><div>&nbsp; &nbsp; static void checkConsistency(const Vector&lt;T&gt;&amp; v)</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; v.checkConsistency();</div><div>&nbsp; &nbsp; }</div><div>};</div><div>#endif</div><div><br></div><div><div>template&lt;typename T, size_t inlineCapacity, typename OverflowHandler&gt;</div><div>inline void Vector&lt;T, inlineCapacity, OverflowHandler&gt;::checkConsistency()</div><div>{</div><div>&nbsp; &nbsp; if (!ASSERT_DISABLED) {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; for (size_t i = 0; i &lt; size(); ++i)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ValueCheck&lt;T&gt;::checkConsistency(at(i));</div><div>&nbsp; &nbsp; }</div><div>}</div><div><br></div></div></div><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;"><br></div><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;">This won’t compile with assertions disabled because ValueCheck::checkConsistency doesn’t exist.</div></blockquote><br></div><div>Oops, I should have read this email before sending my previous reply. It does seem like using if() exclusively to control assertions won’t work.</div><div><br></div><div><br></div><div><div>On Apr 20, 2014, at 2:02 PM, Filip Pizlo &lt;<a href="mailto:fpizlo@apple.com">fpizlo@apple.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="auto"><div>The #if means that the code being guarded isn't indented. I believe that indenting control flow is a good idea.&nbsp;</div></div></blockquote><div><br></div><div>This is the main reason I thought the proposal was promising. Note though that we could change our style guide to call for some indentation of #if’s if we wanted to. It is valid C/C++ to do so. The main is that not all text editors have good support for this.&nbsp;</div><div><br></div><div>Regards,</div><div>Maciej</div></div><div><br></div></body></html>