Frank Heckenbach wrote:
CBFalconer wrote:
Unknown attributions:
Not using a parameter usually indicates a bug
Not necessarily. You often want to design a procedure or function with a spare parameter to cover future extension, and probably document that it shall be called with that parameter zero. The actual procedure code has no reason (today) to use the parameter.
FWIW, I'm not really a fan of this practice (which I've seen in some places, and occasionally tried myself). For one, unless you actually know what the future extensions will be, it's hard to foresee which type the future parameter should have (and if one is enough actually). In C, you might get away with an integer parameter, since almost everything is an integer in C. ;-) In Pascal, you'd often want a better typed parameter.
Besides, I've found that it's usually not *such* a big deal to adjust callers to a new parameter, or to provide a backward-compatible interface (which possibly just calls the new, extended routine, with the new parameters).
Frank
Procedures and functions with unused parameters appear in good code all the time. You build programs by constructing outlines with the routines stubbed out, simply serving as placeholders for routes yet to be constructed. At some point, the program is even going to become operational with many of the unfinished routines left stubbed out. This is a good, organized design method, and its to be encouraged. To me, it means the programmer plans ahead.