< Previous by Date Date Index Next by Date >
  Thread Index Next in Thread >

[reSIProcate] replacing assertions





There are currently a lot of assertions in the code

Disabling them with NDEBUG is not really an option as most of them are actually performing essential checks on things.

I was thinking that it may be worthwhile to create a macro called resip_assert and replace all the assert statements with that.

People could then choose between two or more definitions of this macro, e.g. one that does a normal assert:


        #define resip_assert(x) assert(x)


and another that throws an exception


#define resip_assert(x) if((x)==0) throw std::runtime_error("assertion at " __FILE__ ":" __LINE__);


This doesn't completely eliminate the problem but it may be a useful step towards adding more specific exceptions.