Thanks for the support guys. :)<div><br></div><div>Unfortunately &quot;halt&quot; would still need to be a keyword if one wants to keep the full behavior of assert(0), where the compiler knows that it affects the control-flow of the program.</div>
<div><br></div><div>Legal:</div><div>int main()</div><div>{</div><div>    assert(0);</div><div>}</div><div><br></div><div>Illegal (Error: function D main has no return statement, but is expected to return a value of type int):</div>
<meta http-equiv="content-type" content="text/html; charset=utf-8"><div>int main()</div><div>{</div><div>    int a = 0;</div><div>    assert(a);</div><div>}</div><div><br></div><div><br></div><div><div class="gmail_quote">
2010/10/10 Tomek Sowiński <span dir="ltr">&lt;<a href="mailto:just@ask.me">just@ask.me</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Christopher Bergqvist napisał:<br>

<div class="im"><br>
&gt; Hi,<br>
&gt;<br>
&gt; Time for some Sunday nitpicking. While reading TDPL, one thing that stuck<br>
&gt; out to me was the special behavior of assert(false). Consider the<br>
&gt; following program compiled with &quot;-release&quot;.<br>
&gt;<br>
&gt; void main()<br>
&gt; {<br>
&gt;     int a = 0;<br>
&gt;     assert(a);<br>
&gt; }<br>
&gt;<br>
&gt; That program will run without errors. Changing the type of variable a from<br>
&gt; &quot;int&quot; to &quot;enum&quot; results in the program segfaulting thanks to the compiler<br>
&gt; being able to know the value of the expression &quot;a&quot; at compile time and<br>
&gt; inserting a HLT/&quot;halt&quot; instruction. Having the ability to change something<br>
&gt; subtle in a more complex expression or series of expressions without<br>
&gt; realizing you made a compile time assert(false) which crashes your program<br>
&gt; feels ugly.<br>
&gt;<br>
</div><div class="im">&gt; I would prefer it if assert() didn&#39;t have this special type of behavior,<br>
&gt; and that a &quot;halt&quot; keyword or equivalent was introduced. What do you think?<br>
<br>
</div>I have the same feeling. &#39;halt&#39; is good, &#39;fail&#39; is good too. It doesn&#39;t have to be a keyword, a<br>
function in object.d would suffice.<br>
<br>
BTW, does anybody know the reason for the assert(0) infernal syntax?<br>
<br>
--<br>
<font color="#888888">Tomek<br>
</font></blockquote></div><br></div>