[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ns] question about printing variable in c++



On Wed, 2 Jan 2002, Padmaparna Haldar wrote:

> You can directly call printf or fprintf instead of calling the
> time-expensive tcl.evalf for printing values out either to stdout or a
> file.

a standard debug method that tested local debug_ and if that was set
autoprepended virtual time, object ID and type before dumping a string
out (in a standard format that would become a useful parseable
convention) could be good.

as would a tcl wrapper for same, so you could do e.g.
$ns_object set debug_ 1
if {$cond == $true} {
   $ns_object debug "oh my god, it's full of leaks! Condition is $cond"
}

or somesuch at the Tcl level as well, giving
37.542746 Agent/TCP/Dorking 23165 oh my god, it's full of leaks! Condition is 1

bonus points for being able to redirect all this to either stdout or
stderr or some other stream.

L.

C++, remember? blah blah iostream blah unworkable overhead blah

<[email protected]>PGP<http://www.ee.surrey.ac.uk/Personal/L.Wood/>