Mail Archives: djgpp/2004/09/02/17:44:20
> But: the use of the code above would be to collect arguments passed to
> the command line _except_ yours have no variable to collect!
>
> Since you have put in the body of your main, is no longer a prototype!
You apparently don't understand C++ enough.
The prototype given indicates that the function expects to be passed
two arguments, but does not need to reference them. It is a
consequence of the ability to have *some* of the arguments unnamed as
placeholders (so that you don't get a warning about not using a named
parameter). Consider:
int foo (char *a, int, int b) { }
The second parameter indicates that something *is* passed, and foo
*knows* about it, but doesn't use it.
Compare:
int main() { }
This means that main doesn't expect any parameters.
int main(int, char **) { }
This means that main expects parameters, but won't use them.
- Raw text -