Funny way to crash dmd and brick the whole computer

Stefan Koch uplink.coder at googlemail.com
Fri Sep 28 13:47:45 UTC 2018


On Friday, 28 September 2018 at 11:58:25 UTC, Zardoz wrote:
> CTE fib :
>
> module fib_cte;
> import std.stdio;
>
> long fib(long n) {
>   if (n <= 1) return 1;
>   return fib(n - 1) + fib(n - 2);
> }
>
> static immutable valueFib = fib(46);
>
> void main() {
>     writeln(valueFib);
> }

to be fair, that function is incredibly inefficient.
when you write an iterative fibonacci-series generator, it'll 
work.


More information about the Digitalmars-d mailing list