On Mon, 11 Oct 2010 00:22:38 +0300, Tomek Sowiński <[email protected]> wrote:

BTW, does anybody know the reason for the assert(0) infernal syntax?

From http://www.digitalmars.com/d/2.0/expression.html#AssertExpression:

"The expression assert(0) is a special case; it signifies that it is unreachable code. Either AssertError is thrown at runtime if it is reachable, or the execution is halted (on the x86 processor, a HLT instruction can be used to halt execution). The optimization and code generation phases of compilation may assume that it is unreachable code."

Sometimes it's useful to add an assert(0) at the end of a function which should always return at other points, but the compiler can't know that.

--
Best regards,
 Vladimir                            mailto:[email protected]

Reply via email to