[Assorted-commits] SF.net SVN: assorted: [620] cpp-commons/trunk/src/commons/check.h
Brought to you by:
yangzhang
From: <yan...@us...> - 2008-03-12 20:41:22
|
Revision: 620 http://assorted.svn.sourceforge.net/assorted/?rev=620&view=rev Author: yangzhang Date: 2008-03-12 13:41:21 -0700 (Wed, 12 Mar 2008) Log Message: ----------- added check0 Modified Paths: -------------- cpp-commons/trunk/src/commons/check.h Modified: cpp-commons/trunk/src/commons/check.h =================================================================== --- cpp-commons/trunk/src/commons/check.h 2008-03-10 23:54:07 UTC (rev 619) +++ cpp-commons/trunk/src/commons/check.h 2008-03-12 20:41:21 UTC (rev 620) @@ -10,7 +10,7 @@ using namespace std; - class check_exception : exception + class check_exception : public exception { public: check_exception(const string & name) : name(name) {} @@ -41,20 +41,28 @@ * This is a macro for two reasons: (1) the file and line, and (2) the lazy * evaluation of msg. */ -#define checkmsg(cond, msg) \ - bool b__ = cond; \ +#define checkmsg(cond, msg) \ + bool b__ = cond; \ if (!b__) _check(b__, (msg), __FILE__, __LINE__) // TODO: half-written -#define checkmsgf(cond, msg, ...) \ - do { \ - bool b__ = cond; \ - if (!b__) { \ - char s__[4096]; \ - snprintf(s, ); \ - _check(b__, s__, __FILE__, __LINE__); \ - } \ +#define checkmsgf(cond, msg, ...) \ + do { \ + bool b__ = cond; \ + if (!b__) { \ + char s__[4096]; \ + snprintf(s, ); \ + _check(b__, s__, __FILE__, __LINE__); \ + } \ } while (0) +#define check0(expr) \ + do { \ + typeof(expr) r__ = expr; \ + if (r__ != 0) { \ + return r__; \ + } \ + } while (0) + #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |