00001 #include <j2k/Fred/Error/ErrorCode.hpp> 00002 00003 00004 00005 ErrorCode doSomeJob(int i) 00006 00007 { 00008 00009 if (i == 0) { 00010 00011 return MyError1; 00012 00013 } else if (i > 10) { 00014 00015 return MyError2; 00016 00017 } 00018 00019 00020 00021 // ... 00022 00023 00024 00025 return Success; 00026 00027 } 00028 00029 00030 00031 00032 00033 ErrorCode myFunc(void) 00034 00035 { 00036 00037 doSomeJob(0); // <-- return value not used 00038 00039 00040 00041 ErrorCode err = doSomeJob(5); 00042 00043 err = doSomeJob(15); // <-- previous value of err not tested 00044 00045 if (err != Success) // <-- return value is tested 00046 00047 return err; 00048 00049 00050 00051 ... // some code 00052 00053 00054 00055 return Success; 00056 00057 } 00058 00059 00060 00061 00062 00063 int main(void) { 00064 00065 return !(myFunc() == Success) 00066 00067 } 00068