a though to help with debugging ns

Lloyd Wood L.Wood@eim.surrey.ac.uk
Fri, 21 Jan 2000 14:39:07 +0000 (GMT)


On Fri, 21 Jan 2000, Mark Allman wrote:

> > Since the variables are class variables and have local scope, why
> > not just be clear and consistent and call them *all* debug_ ?
> 
> Nice.  That would be better, I think.

Additional twist:
define and bind verbose_ similarly, and

#define NOW Scheduler::instance().clock()

consistently across ns. That will make it easier to write
self-documenting code to explain functionality and track the operation
of anything you're interested in.

if (verbose_) {
          printf("Doing foo at time %.3f\n",NOW);
}

and

if {[$tcp0 set verbose_]} {
          puts "extra stuff about configuration info below"
}

Arguably better than comments. The difference between verbose_ and
debug_ is that debug_ never gets used in release code...

(How would you create a bound class variable - myname_ say,with the
 full name and network location of the object it belongs to, for
 printing out?)

L.

<L.Wood@surrey.ac.uk>PGP<http://www.ee.surrey.ac.uk/Personal/L.Wood/>