Bug 150 - CommandLine::Parse argc parameter should not be a reference
: CommandLine::Parse argc parameter should not be a reference
Status: RESOLVED FIXED
: ns-3
simulation core
: pre-release
: All All
: P3 minor
Assigned To:
:
:
:
:
  Show dependency treegraph
 
Reported: 2008-03-22 13:36 EDT by
Modified: 2008-07-01 13:32 EDT (History)


Attachments


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2008-03-22 13:36:33 EDT
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.
------- Comment #1 From 2008-03-22 13:58:38 EDT -------
(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.
------- Comment #2 From 2008-04-15 12:53:10 EDT -------
changeset 3573d91994cc