-
Plenty of two cents here I know, but mine are:
I only return a status variable when using Dynamic Memory Allocation, when accessing files, or any other time when errors may be beyond the control of the coder.
I return an integer, 1 or 0. This works the same as BOOL and looks prettier to me (I like pretty things :)
I think the advantage is small, in that your error checking code is shorter, i.e.
Code:
if(!MyFunction())
{
// do error handling
...
// as opposed to
int success;
MyFunction(success);
if(!success)
{
// do error handling
...
The latter is easier to read although it makes more 'if' nests in the function/ procedure itself.
I guess it really is just preference.
dt
-
I agree I prefer to use the function as a status variable be it boolean or integer rather than using the status variable as a parameter to the function.
Just my two cents.
:rolleyes: