[[ blog 이사 과정에서 정확한 posting날짜가 분실됨. 년도와 분기 정도는 맞지 않을까? ]]
In terms of function's return value, I classify three types.
In terms of function's return value, I classify three types.
type 1 : Function may fail with quite high possibility.
return value tells details about success or fail reason.
Ex.)
return_value == 0 : general success.
return_value > 0 : success with additional information [value represents additional information]
return_value < 0 : fails [value represents error code]int open_service(...) {...}
type 2 : Function may fail with very low possibility.
return value tells the result or "success or fail".
Ex.)
return_value == NULL : fails.
otherwise : return_value is result.Item* List::next() {...} FILE* fopen(...) {...}In this case, we may need additional function like "get_last_error()" - like MSVC's API.
type 3 : Function never fails.
return value is result, 'void' or instance itself to easy-next-use.
Ex.)
int get_id() {...} void set_color(int color) {...} Paint* Paint::set_color(int color) {...; return this;}
'Language > C&C++' 카테고리의 다른 글
[C/C++] Mimicking Signal and Slot (0) | 2010.04.08 |
---|---|
[C/C++] Intereseting compile error of Passing function pointer as an argument of template class member... (0) | 2009.09.28 |
[C/C++] new operator... deeper.... (0) | 2009.08.24 |
[C/C++] Remind! Limitation of constructor; It doens't give return value!.. (0) | 2009.05.15 |
[C/C++] 'const' keyword. (0) | 2009.03.11 |