[openbeos] Re: B_TRUE/B_FALSE

  • From: "Jonas Sundstrom" <kirilla@xxxxxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Sun, 21 Sep 2003 14:01:36 +0200 CEST

Tyler Dauwalder <tyler@xxxxxxxxxxxxx> wrote:
> Another option is then to use a boolean output parameter and return a 
> status_t instead, but output parameters are just annoying.
> #define B_FALSE 0
> #define B_TRUE 1
> then, one could just return a status_t for the function, check for "<
>  B_OK" 
> to see if an error occurred (yielding a hopefully useful error code 
> if so), 
> and if not, check against B_TRUE or B_FALSE to see what the result of 
> the 
> function was. 
> You could also define a bool_t or a boolstatus_t type that's 
> identical to 
> status_t, but whose use as a return value would flag the function as 
> operating as described above instead of just returning a standard 
> status_t.
> Thoughts?

Are you saying you'd prefer something other than the current
way of returning status_t and if (status != B_OK)
check the error code if it's B_ERROR_X, B_ERROR_Y, ..
or prinft("Error: %s\n", strerror(status));

What problem are you trying to solve?

/Jonas Sundström.                      www.kirilla.com

Other related posts: