diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2008-10-10 10:30:14 -0500 |
---|---|---|
committer | Erik Schnetter <schnetter@cct.lsu.edu> | 2008-10-10 10:30:14 -0500 |
commit | b313954f749c86c026ace7318311638dead15551 (patch) | |
tree | f9d642c5853dffdd350c388de9c052e05efa4ff4 /Carpet/CarpetLib/src/defs.hh | |
parent | 377d40f411bee54cc45e513e53eea511372e5c6d (diff) |
CarpetLib: Define new macro "check(expr)" to check the return values easily
The new macro check(expr) evaluates the expression expr, and then asserts
that it is true. If assertions are disabled the expression is still
evaluated.
Diffstat (limited to 'Carpet/CarpetLib/src/defs.hh')
-rw-r--r-- | Carpet/CarpetLib/src/defs.hh | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Carpet/CarpetLib/src/defs.hh b/Carpet/CarpetLib/src/defs.hh index d1d8b73f0..a44d20ef0 100644 --- a/Carpet/CarpetLib/src/defs.hh +++ b/Carpet/CarpetLib/src/defs.hh @@ -28,6 +28,11 @@ using namespace std; +// Check a return value +#define check(_expr) do { bool const _val = (_expr); assert(_val); } while(0) + + + // Define the restrict qualifier #ifdef CCTK_CXX_RESTRICT # define restrict CCTK_CXX_RESTRICT |