Bugzilla – Bug 150
CommandLine::Parse argc parameter should not be a reference
Last modified: 2008-07-01 13:32:25 UTC
Something I found out while working on python bindings: /** * \param argc the 'argc' variable: number of arguments (including the * main program name as first element). * \param argv the 'argv' variable: a null-terminated array of strings, * each of which identifies a command-line argument. * * Obviously, this method will parse the input command-line arguments and * will attempt to handle them all. */ void Parse (int &argc, char *argv[]) const; This is wrong; the only explanation for argc being a reference would be that it is inout or out argument. However, when I looked at the sources I was surprised to discover that it was neither. In this case the & is misleading and unnecessary.
(In reply to comment #0) > Something I found out while working on python bindings: > > /** > * \param argc the 'argc' variable: number of arguments (including the > * main program name as first element). > * \param argv the 'argv' variable: a null-terminated array of strings, > * each of which identifies a command-line argument. > * > * Obviously, this method will parse the input command-line arguments and > * will attempt to handle them all. > */ > void Parse (int &argc, char *argv[]) const; > > This is wrong; the only explanation for argc being a reference would be that it > is inout or out argument. However, when I looked at the sources I was > surprised to discover that it was neither. In this case the & is misleading > and unnecessary. > You are right.
changeset 3573d91994cc