Rosettacode: program termination
John Colvin
john.loughran.colvin at gmail.com
Mon Apr 14 03:11:57 PDT 2014
On Monday, 14 April 2014 at 09:58:09 UTC, bearophile wrote:
> I have added a D entry regarding how to terminate D programs.
> What's missing?
>
> http://rosettacode.org/wiki/Program_termination#D
>
> Bye,
> bearophile
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);
}
More information about the Digitalmars-d-learn
mailing list