#include #define INCLUDE_FUNCS 1 using namespace std; enum ErrorCode { MB_SUCCESS = 0, MB_FAILURE = 1 }; class ErrorInfo { public: #ifdef INCLUDE_FUNCS inline ErrorInfo() : mErrorCode(MB_SUCCESS), msg(NULL) {} inline ErrorInfo(const ErrorCode ec) : mErrorCode(ec), msg(NULL) {} inline ErrorInfo &operator=(const ErrorInfo &info) {mErrorCode = info.mErrorCode; msg = info.msg; return *this;} #endif ErrorCode mErrorCode; char *msg; }; inline ErrorCode test_return_0(long n) { if (n > 0) return test_return_0(n - 1); return MB_SUCCESS; } inline ErrorInfo test_return_1(long n) { if (n > 0) return test_return_1(n - 1); return ErrorInfo(); } int main() { for (long i = 0; i < 1000000; i++) test_return_1(10); // Change to test_return_1(100000) for comparison return 0; }