Linked by Thom Holwerda on Mon 4th Aug 2008 23:12 UTC
Thread beginning with comment 325909
To view parent comment, click here.
To read all comments associated with this story, please click here.
To view parent comment, click here.
To read all comments associated with this story, please click here.





Member since:
2005-07-24
Well, I, for one, employ a debug-mode set of checks for error-case returns from any function within my own API ( I don't use standard APIs without further abstraction and management ).
BeOS doesn't provide access to enough low-level hooks which throw exceptions, instead debugger calls are made directly from within the API, which I dislike immensely. Granted, I hate dealing with exceptions as much as any other coder, but I prefer to do my own error handling as much as possible.
My error handling is accomplished via a global non-release-mode object called 'ErrorTracker," which is accessible via the _error pointer. So when I have an error a call is made: _error->Critical(ERR_LOOP_BOUNDS, ClassInfo(this).cleanName(), "functionName()", __LINE, __FILE, kLoopBoundErrorString);
I use macros to clean it up:
CriticalError(ERR_LOOP_BOUNDS, this, "functionName()");
The macros are disabled in release-mode and the _error pointer is inaccessible. Of course, my debug mode is really well layered, supporting four modes each giving more information than the last, the most advanced creates a GUI so that lists, allocators, and all other possible fail-points can be visually monitored with little reliance on tracing through the command line or falling back into the bdb ( Be Debugger ).
--The loon
If int is negative, the code never got that far anyway, as 'someone' is requesting something wrong, improper return is considered fatal in most cases, but not all.. but then you'd need to see my API to really get it, I guess- and it will not be made public for at least a year or so ( waiting on Haiku to repair one specific bug before I can make adjustments, as I'm ending all development on the old code base ).