From 018e85f150d0a1b4b1ab64cfdf843e5bc23d60d0 Mon Sep 17 00:00:00 2001 From: Davis King Date: Sun, 24 Apr 2016 10:05:37 -0400 Subject: [PATCH] Improved CHECK_CUDA() macro --- dlib/dnn/cuda_utils.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlib/dnn/cuda_utils.h b/dlib/dnn/cuda_utils.h index 90e5adf2f..40695371e 100644 --- a/dlib/dnn/cuda_utils.h +++ b/dlib/dnn/cuda_utils.h @@ -15,7 +15,7 @@ // Check the return value of a call to the CUDA runtime for an error condition. #define CHECK_CUDA(call) \ -{ \ +do{ \ const cudaError_t error = call; \ if (error != cudaSuccess) \ { \ @@ -24,7 +24,7 @@ sout << "code: " << error << ", reason: " << cudaGetErrorString(error);\ throw dlib::cuda_error(sout.str()); \ } \ -} +}while(false) // ----------------------------------------------------------------------------------------