Created
May 24, 2012 13:20
-
-
Save Linux-cpp-lisp/2781511 to your computer and use it in GitHub Desktop.
A few small macros used to simplify error handling in C++ code that uses POSIX and UNIX system calls. Depends on an exception class UNIXError, which just happens to have an argument-less constructor that will get an error string based on the current value
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define ERR(__statment, __retVar) ((__retVar=(__statment))==-1 ? throw UNIXError() : (__retVar)) | |
#define ERR_ERRVAL(__statment, __retVar, __errval) (((__retVar)=(__statment))==(__errval) ? throw UNIXError() : (__retVar)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment