← Back to team overview

dolfin team mailing list archive

Implementing our own assert

 

Would it be a good idea to implement our own assert (dolfin_assert)
which would use an #ifdef to stay out of place when not building with
the DEBUG flag enabled.

The point would be for it to call dolfin_error instead of just
segfaulting. That way it's very easy to see where it comes from since
it will generate a trace in Python.

I'm debugging some unit tests now which give

......python:
/home/logg/scratch/src/dolfin/1.0.x-logg/dolfin/la/EpetraVector.cpp:306:
virtual void dolfin::EpetraVector::get_local(dolfin::Array<double>&)
const: Assertion `x' failed.

and I have no idea from which test this comes from.

We had our own assert before bug decided to use the standard C++
assert.

Any objections to me adding a dolfin_assert and replacing all asserts?

--
Anders


Follow ups