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

Re: [ns] assert doesn't work in ns?



On Wed, 10 May 2000, Felix Hernandez Campos wrote:

> Li Li wrote:
> 
> >  c++ "assert" statement doesn't work in my ns-2.1b6 c++ code. I have tested
> > it with simple c++ programs using the same c++ compiler. It works fine. So
> > it's not a compiler problem. Can anyone tell me how to make assert work in
> > ns c++ code?

for ns snapshots later than 24 March 2000 and simulation debugging,
I'd be tempted to do something like:

if (debug_ && (!expression))
    printf ('something a bit more test-specific');

and

$object set debug_ 1

instead of using assert(expression). This might make some existing
uses of assert() less opaque...

L.

> If you look in the Makefile, you will see that NDEBUG is defined, so assert()
> macro tests are disabled. You can probably just remove -DNDEBUG from DEFINE in
> the Makefile to enable asserts. Check "man assert" for more information.

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