Skip to main content
gamedev.net
🔒 Locked

exception throwing smart_assert

Started by psykr 0 replies 500+ views
Original Post
psykr
psykr
In two of Alexandrescu's articles (assertions and enhancing assertions), he introduces nifty "extensions", if you will, to the C++ assertion mechanism. The first assertion type that he introduced had a syntax similar to the following: ASSERT<ExceptionType>( expression, message ); Instead of breaking on an assertion, you can optionally throw an exception of the specified type. The second type is more like SMART_ASSERT( expression )(values).msg( message ); Now, I absolutely adore the smart assert. However, I'd like to be able to specify an exception type to be thrown as well. Unfortunately, the two macros seem to be incompatible as the first type uses function overloading to accomplish the different forms of assert, and the macro definitions are just different. I'm thinking of just giving up on the exception-throwing syntax, because it seems to be more trouble than its worth, and if the asserts were compiled out in release mode the exceptions would have to be thrown by something else anyway. Has anyone else had this urge to create an überassert, or generally have any input on this topic? edit: subject change

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.