[A86] Re: SDCC v2.3.0 (fib.c)


[Prev][Next][Index][Thread]

[A86] Re: SDCC v2.3.0 (fib.c)




I think that's a poor example.  It uses printf, which you wouldn't use in
assembly.  Also, it uses function recursion, instead of data recursion.  If
I was going to program that in assembly, I would use an iterative loop.  I
realize that it is the classic example of recursion, but generally using
recursion like that is bad.  When you do any real work with large trees, for
example, you have to ditch that simple WalkTree function and go for building
stacks yourself.

You were saying that SDCC generates good code?  I'm sorry, but that code
looks terrible to me.  Why is it passing values on the stack when it could
be passing them using registers?  Especially when it's a single value?  And
it's creating a stack frame when it's not needed.

> At the moment I've got a fibonacci calculator, it works on the z88dk,
> haven't/couldn't/whatever test it for SDCC.






References: