00001 #ifndef _ERROR_H 00002 #define _ERROR_H 00003 00004 #include <stdio.h> 00005 00006 #define SUCCESS 0 00007 #define FAILURE 1 00008 00009 #define TRUE 1 00010 #define FALSE 0 00011 00012 // print a warning (when return value is ignored) 00013 #define WARN(format, args...) fprintf(stderr, "[%s:%d %s()] " format "\n", \ 00014 __FILE__, __LINE__, __func__, ## args) 00015 00016 // print a warning with return value of FAILURE 00017 #define ERROR(format, args...) (WARN(format, ## args), FAILURE) 00018 00019 // NOTE: ASSERT is used only when you want to issue a warning in a case 00020 // that should not happen and when there is no way to recover. 00021 // If there is any way to recover, use ERROR() and handle the problem. 00022 //#define ASSERT(x, args...) if (! x) WARN("ASSERT FAILED (" #x ") " args) 00023 00024 #endif /* _ERROR_H */ 00025 00026
1.4.4