Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

#define phCHECK_RC rc,
fmt   )     phDO_CHECK(rc,pmsg,fmt, goto error, ## __VA_ARGS__ )

This performs the 'goto error' action using the phDO_CHECK macro that checks for rc < 0 . This is the most used macro throughout Phission. It is the main method of error handling and recovery for most functions and methods. Within conforming methods and functions there is an error label that is jumped to when an error occurs. After jumping to the error label the function or method usually returns phFAIL or some other error value. Between the error label and the return statement goes any code that is necessary to clean up the state of the system within the scope of the function to the point where the error occured.

For example, if any memory was allocated and then the system tried to perform some operation that resulted in an error, the memory would still need to be freed. The error would cause a function to return a negative value that would be passed to this macro and cause the jump to the error label. Then the memory could be freed.

The error label is usually at the end of the function and there is almost always a

 return phSUCCESS; 
statement preceeding/before it.

Don't use this macro or any other macro that jumps to 'error' after the 'error' label.

Definition at line 159 of file phError.h.

Copyright (C) 2002 - 2007 Philip D.S. Thoren ( )
University Of Massachusetts at Lowell
Robotics Lab Logo

Generated on Sat Jun 16 02:45:27 2007 for phission by  doxygen 1.4.4