← Back to team overview

dolfin team mailing list archive

Re: Implementing our own assert

 

On Friday November 18 2011 08:50:38 Anders Logg wrote:
> On Fri, Nov 18, 2011 at 08:36:01AM -0800, Johan Hake wrote:
> > On Friday November 18 2011 02:29:18 Anders Logg wrote:
> > > On Thu, Nov 17, 2011 at 11:02:30AM -0800, Johan Hake wrote:
> > > > On Thursday November 17 2011 10:55:34 Anders Logg wrote:
> > > > > 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?
> > > > 
> > > > That would be great!
> > > 
> > > In progress... dolfinreplace works great! :-)
> > :
> > :)
> > 
> > Would be cool if we could apply some regexp to that script too!
> 
> Yes. It ended up replacing dolfin_assert by dolfin_dolfin_assert... :-)

He, he. I always run dolfin_replace using -s (simulate) to test what happens 
first.

Johan

> --
> Anders


References