assert(false) in release == splinter in eye

Denis Koroskin 2korden at gmail.com
Sun Oct 10 18:12:11 PDT 2010


On Mon, 11 Oct 2010 03:53:07 +0400, Christopher Bergqvist  
<chris at digitalpoetry.se> wrote:

> Thanks for the support guys. :)
>
> Unfortunately "halt" 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.
>
> Legal:
> int main()
> {
>     assert(0);
> }
>
> Illegal (Error: function D main has no return statement, but is expected  
> to
> return a value of type int):
> int main()
> {
>     int a = 0;
>     assert(a);
> }
>
>

Just a random thought:

class Foo
{
     this(int i) { ... }
}

class Bar
{
     this(int j) { assert(false); }
}

Still illegal, but that's a bug I guess.


More information about the Digitalmars-d mailing list