An example from http://webgpu.hwu.crhc.illinois.edu/mp/0
#define wbCheck(stmt) do { \
cudaError_t err = stmt; \
if (err != cudaSuccess) { \
wbLog(ERROR, "Failed to run stmt ", #stmt); \
wbLog(ERROR, "Got CUDA error ... ", cudaGetErrorString(err)); \
return -1; \
} \
} while(0)
Explanation:
http://stackoverflow.com/questions/257418/do-while-0-what-is-it-good-for