[vtk-developers] Use of assert

Mathieu Malaterre mathieu.malaterre at kitware.com
Thu Jul 21 10:35:54 EDT 2005


Ken,

   Since I am responsible for most of the undocumented assert in the XML-IO stuff, here are my thoughts. According to Berk application like ParaView can be build in Debug mode (meaning with assert enable). He believes that ParaView should not ever abort on purpose. 

   Most of the assert are checking that the inputs are correct for the functions. There are still some other assert that check nothing 'impossible' is happening. That was and still is pretty usefull for debuging. For instance I was not reinitializing the array when the user was reusing the same writer. The assert caught it right away, the bug was solved almost immediately.

   Therefore the question is what should one do with those type of assert when something new is added to VTK and hasn't been tested for a long time ?

   BTW what kind of user on purpose build ParaView in Debug mode ? What are your comment on the above, and on the fact that your application could abort ?

Thanks,
Mathieu

> Since I am seeing more use of assert in VTK, such as...
> 
>     assert(numPieces > 0);
> 
> is there a reason why we shouldn't require that people comment their assert
> statements? For example the above assert should be 
> 
> assert(numPieces > 0 && "OffsetGroupManager allocation requested for
> numPieces <= 0")
> 
> I think on most systems if the debugger is not invoked the content of the
> assert will be displayed at least. Am I missing something?
> 
> Thanks
> Ken
> 
> 
> _______________________________________________
> vtk-developers mailing list
> vtk-developers at vtk.org
> http://www.vtk.org/mailman/listinfo/vtk-developers
> 




More information about the vtk-developers mailing list