In re: SUBS vs. GOSUBS, Ray Penas wrote:
RP> As you saw from your limited testing, there is overhead ...
RP> ... anything that is local to the sub needs to be on the stack.
As an assembly language programmer, I can tell you that passing
parameters on the stack is not just common practice in that field, but
also that passing parameters in registers (the fastest possible way)
won't work in most cases because you run you out of registers a fat big
hurry! So, you end up putting stuff on the stack every time you call a
new routine -- and IMHO, without routines to keep things straight,
assembly language would be a nightmare, 100 times tougher than it
already is.
RP>One problem I have with them is that people use them for a small minor
RP>function and tend to have a large number of them.
If you have a chance to look into the book _Code Complete_, by Steve
McConnell, I think it might change your perspective about the "VERY
bad" nature of SUBS and FUNCTIONS. Plus it has a fistful of excellent
ideas, and a lot of hard data to back itself up, instead of just
spouting "religious" opinions, making worthwhile for any programmer to
read.
* SLMR 2.1a * MAXLIB For PB v1.1 - Access arrays and files in EMS/XMS!
--- WILDMAIL!/WC v4.12
---------------
* Origin: Com-Dat BBS - Hillsboro, OR. HST DS (1:105/314.0)
|