On (24 Mar 95) Ray Penas wrote to Chris Adams...
RP> Subs/Functions are VERY bad. They are slower and take up more code
RP> space. What's wrong with gosubs?
I'm looking for readability and non-spaghetti code. Also, I doubt that
they seriously cause problems in a WELL designed program, not to mention
they allow easy return values and passed parameters. Sure, you can
assign these before and check afterward, but that takes time itself,
Consider what happens:
CALL SUB(Arg1, Arg2, etc)
This is treated, afair, something like this:
push segment arg1
push offset arg1
[etc]
call far [address of subroutine]
gosub just pushes the current CS & IP, calls it and returns. So all we
have is a few extra pushes. Note, too, that functions just have one
extra step, popping the return value. This really isn't too much
overhead if you have a well designed program.
Also, we get things like local variables, etc, much easier.
... The sight of death frightens them [Earthers].
--- PPoint 1.88
---------------
* Origin: The Point of Obfuscation! (1:212/2001.5)
|