Hello Valeriy,
Finally, I fixed this problem. The fix will be in revision
5.15.04 which will be exposed early next week.
However, I personally do not like this kind of programming.
Recursive call can waste physical resources. This small
example with a tiny job uses up very deep stack memory.
This is mostly okey for PCs. But, imagine somebody wants
to put this nice picture on a small devices like celler phone
where every piece of physical resource is precious.
Thank you
Masaharu Goto
> Hi Masa,
>check elegant&small&funny example which works when compiled,
>but unfortunately doesn't work correctly when interpreted.
>
>Regards. Valeriy
>
>
>int tree(int x)
>{
> static int y=0;
> static int z=0;
> static int qq = printf("%5s","*");
>
> x = x>0 ? -9: x;
> z = (z=x+5)>0 ? z:-z;
> printf(!x&&++y ? "\n":(z?(z>y%3+y/3?" ":(x<-5 ?"/" :"\\")):"|"));
> return (y-9) ? tree(++x) : printf(" _|_|_\n \\___/\n");
>}
>
>root [0] .L tree.C++
>root [1] tree(0)
> *
> /|\
> //|\\
> /|\
> //|\\
> ///|\\\
> //|\\
> ///|\\\
>////|\\\\
> _|_|_
> \___/
>(int)16
>root [2]
>
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:50 MET