Bug 1572 - Omitted main () in tutorial code sample
Omitted main () in tutorial code sample
Status: RESOLVED WONTFIX
Product: ns-3
Classification: Unclassified
Component: documentation
pre-release
All All
: P5 trivial
Assigned To: Tom Henderson
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-01-24 12:54 UTC by aram
Modified: 2013-01-26 13:20 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description aram 2013-01-24 12:54:22 UTC
At the tutorial found here 
http://www.nsnam.org/docs/tutorial/html/building-topologies.html

The code 

int
main (int argc, char *argv[])
{

is omitted from the following code sample presented in the tutorial.

bool verbose = true;
uint32_t nCsma = 3;

CommandLine cmd;
cmd.AddValue ("nCsma", "Number of \"extra\" CSMA nodes/devices", nCsma);
cmd.AddValue ("verbose", "Tell echo applications to log if true", verbose);

cmd.Parse (argc, argv);

if (verbose)
  {
    LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_INFO);
    LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_INFO);
  }

nCsma = nCsma == 0 ? 1 : nCsma;
Comment 1 Tom Henderson 2013-01-25 14:57:17 UTC
I don't think that this needs to be addressed; the omission of main() was intentional since it is common to every C++ program.
Comment 2 aram 2013-01-26 13:20:20 UTC
Because the code sample was closing with

  return 0;
}

I thought it would be a good idea to begin with the main, in case someone
wants to only copy paste the code and test it.

In any case it is a trivial thing.
I apologize for the noise.