If truthValue is a bool return bool.
This prevents a type coersion (no biggie).
Another reason is it is conventional to return an int to report status where 0 is successful and non-zero number represents an error condition. So the following would be unintutive from the callers perspective:
int process()
{
bool success = false
if (the process was successful)
success = trrue;
return success;
};
Conventionally, it should be either
bool process()
{
bool success = false
if (the process was successful)
success = true;
return success;
}
so main is:
int main()
{ return process() ? EXIT_SUCCESS : EXIT_FAILURE; }
or
int process()
{
int result = EXIT_FAILURE
if (the process was successful)
result = EXIT_SUCCESS
return result;
};
so main is:
int main()
{ return process(); }
answered 2010-01-20T03:40:26.523