From b98af44fcf89b9946e1de438b1f5527e6bf28905 Mon Sep 17 00:00:00 2001 From: Ivan Shapovalov Date: Sat, 22 Oct 2016 05:14:19 +0300 Subject: treewide: use C++ exceptions properly Since the codebase is designed around proper C++ idioms such as RAII, it makes sense to only use C++ exceptions internally instead of mixing exceptions and error codes. The exceptions are now caught at top level to preserve compatibility with the existing error code-based API. Note that we deliberately do not catch C++ runtime errors (such as `std::bad_alloc`) nor logic errors (aka failed assertions) because no actual handling can ever happen for such errors. However, in the C interface we do catch _all_ exceptions (...) and convert them into a wild-card error code. --- src/utilities.hpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src/utilities.hpp') diff --git a/src/utilities.hpp b/src/utilities.hpp index 038a8a96..a7fcbd25 100644 --- a/src/utilities.hpp +++ b/src/utilities.hpp @@ -24,6 +24,7 @@ #include "clblast.h" #include "clblast_half.h" #include "clpp11.hpp" +#include "clblast_exceptions.hpp" #include "msvc.hpp" @@ -207,11 +208,6 @@ bool CheckArgument(const int argc, char *argv[], std::string &help, const std::s // ================================================================================================= -// Helper function to check for errors in the status code -inline bool ErrorIn(const StatusCode s) { return (s != StatusCode::kSuccess); } - -// ================================================================================================= - // Returns a random number to be used as a seed unsigned int GetRandomSeed(); -- cgit v1.2.3