| ??? 01/02/04 14:24 Read: times |
#61739 - RE: Whats wrong with good ol pointer/global? Responding to: ???'s previous message |
In processing of serial protocols the string parsers and error checkers can get pretty long. To move out a block of code to another function,"inheriting" the variables is handy. In this case it means parameters by reference. Of course one cannot still overcome the limit of the stack during calls, so deep nesting can still be a problem.
A pointer by itself is useless, it also needs to point to a variable so a variable must also exist. That makes the pointer an unnecessary overhead, if I can have "by reference". Global variables tie up the memory permanently, so we avoid them. In the long run even if I am the only programmer of the project, too many global variables make the code difficult to maintain. |



