c++ - CUDA: NVCC gives controlling expression is constant warning on assert -
i warning controlling expression constant
on assert statement this:
assert(... && "error message");
why warning on assert? how can suppress warning?
nvcc nvidia cuda compiler, think based on llvm. why give warning, when same compiles fine gcc or visual c++ compilers?
a portable alternative (possibly wrapped in macro) like:
{ const bool error_message = true; assert([...] && error_message); }
to clear meant:
#define myassert(msg, exp) { const bool msg(true); assert(msg && (exp)); } // usage: myassert(ouch, && b);
... gives e.g.:
assertion "ouch && (a && b)" failed [...]
Comments
Post a Comment