RP>Subs/Functions are VERY bad. They are slower and take up more code
RP>space. What's wrong with gosubs?
Hmmm. I just had to jump in here and spill my two cents worth.
You say that Subs/Functions are VERY bad. This is a strong statement!
Your reasons are that:
1) they are slower and
2) they take up more code space.
This is marginally true, but you don't say how much slower or how much
more code space they consume.
I believe you'll find that even on an XT a SUB vs. a GOSUB will net you
a performance penalty of far less than one millisecond. IMHO, it is
not worth a hoot to code around that kind of performance penalty,
unless the SUB is an identified bottleneck, being called thousands of
times.
As for code space, that's easy to test. A SUB with two integer
parameters is about average. It compiles 35 bytes bigger than a
comparable GOSUB. If a program is very small and only has four or five
subroutines in it, this is a measly hit. Then again, if the program is
very large and has several hundred subroutines, using GOSUB will save
several Kbytes, but at the cost of a maintainence nightmare.
As for "what's wrong with GOSUBS?"...
1) they can only act on global data
2) they must be in the main module
3) they are harder to reuse
For my style of programming, a SUB/FUNCTION is a slam dunk.
No doubt you disagree and code accordingly. That's fine. But I hate to
see such strong statements bandied about without any data behind them.
* 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)
|