Funny way to crash dmd and brick the whole computer

Norm norm.rowtree at gmail.com
Fri Sep 28 22:16:35 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);
> }

This isn't a brick, this is your OS not handling lack of 
resources. A brick is when the machine will no longer boot 
without some physical intervention like JTAGing or replacing 
parts.

DMD sacrifices memory for speed so it is not surprising given 
that code abomination.

bye,
norm






More information about the Digitalmars-d mailing list