Rosettacode: program termination

Andrea Fontana nospam at example.com
Tue Apr 15 00:39:01 PDT 2014


On Monday, 14 April 2014 at 11:16:41 UTC, bearophile wrote:
> John Colvin:
>
>> I think notInifnite is too contrived, you would always just 
>> use `else` there. This is more realistic:
>>
>> int notInfinite(in int b) pure nothrow {
>>    if (b < 0)
>>        return 10;
>>    if (b > 10)
>>        return 20;
>>
>>    // In release mode this becomes a halt, and it's sometimes
>>    // necessary. If you remove this the compiler gives:
>>    // Error: function test.notInfinite no return exp;
>>    //    or assert(0); at end of function
>>    assert(false);
>> }
>
> OK, I have improved the code:
> http://rosettacode.org/wiki/Program_termination#D
>
> Bye,
> bearophile

What about:

static ~this() { "asdasdasd".writeln; }

?


More information about the Digitalmars-d-learn mailing list