I've seen code of the form:
void doSomething(int) {
...
}
doSomething(3);
No variable name for the parameter is specified. Creating a small test program, if I step into the doSomething function, I see there is a local variable called __formal, which has the value I passed into the function.
I'm confused as to why one would do this? I can access the parameter using the __formal variable.
You can also specify multiple parameters, such as:
void doSomething(int, float) {
...
}
doSomething(3, 17.0);
The debugger says there are two local variables called __formal, but I don't see how I can access the 2nd parameter; __formal gives me the first parameter.
I am also looking at production level code where they do this, and they never access a __formal parameter in the body of the function. Why force the caller of the function to pass in the parameter when it is never used?
edit: Language = C++, compiler = VS 2003