Qbasicnews.com

Full Version: Structured Programming
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Quote:Sometimes, a GOTO comes handy to do an optimization

Wink

In other words, you can always find an structured solution, but sometimes GOTO is faster.
Quote:long names for variables may even slow up the program.

Please explain, I don't understand.
longer varibles means more chars in the porogram making it slightly bigger, and longer variable names lengthens the seach of the program if u have variables with similar names, wat ive done in the past is at the and of production, i use the change function in qb to change all variales to a - z using appropriate symbols, and if more are required, then i use aa - zz, etc. and the goto thing can help, like wat if u want to exit a sub(s) without completeing it, and exit the loop(s) without using an extra variable called like exitloop or something like that
i was under the impression that varnames are changed during compilation to adresss therefore all varnames will be essentially the same size on compilation. I could be wrong though
be rite though, i nvr decomplied a qb program to see if it does change the variables to adresses along with removing comments ot remarks
The way I solved the problem a long time ago of using text book style of long descriptive names for variables etc is to compromise by using short abbrevaited descriptions. Alternatively list very short variables along with their full descriptions at the start of the program

Gordon
Axipher, have you tried compiling a program before and after you changed all the names of the variables and see if the resulting exes were different? My guess is that the exes are exactly the same, or you made a mistake while changing the names.
i have tried yes and it does make a slight speed diference, of course my programs were small so bigger programs may be slightly different, its not really that much though, the most it affects for me is getting keyboard and mouse input, other then that it works pretty much the same
Quote:
long names for variables may even slow up the program

Slow......up? :lol:

I think in general this is not just about GOTO but about having to "structure" every single line as much as possible, and this would often include unnecessary TYPE-like structures.
aga, what was the biggest application you ever wrote and how long was the maintenance phase after you finished the application?
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16