[reSIProcate] replacing assertions

Daniel Pocock daniel at pocock.pro
Fri Dec 12 06:46:30 CST 2014




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.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.resiprocate.org/pipermail/resiprocate-devel/attachments/20141212/d89dafb0/attachment.htm>


More information about the resiprocate-devel mailing list