On Mon, Jan 5, 2009 at 6:40 PM, Toru Maesaka <d...@torum.net> wrote:
> Hi!
> Something I've been pondering lately is the return value for success/failure
> in our internal functions.
> Returning 0 for success and anything else as an abnormal status is fine but
> at various places we treat stdbool/C++'s false as success and true as
> failure which looks weird to my eyes. It also means that we have to comment
> a lot to make sure people don't get confused (some places I'm sure these
> comments don't even exist).
> So, would it make sense to create a bunch of enums like, DRIZZLE_SUCCESS,
> DRIZZLE_FAILURE and etc to use internally? It would help sustain consistency
> in the codebase.
> It beats seeing comments like this everywhere I think:
> 3214   RETURN
>
> 3215     0  - OK
>
> 3216     -1 - error
>
> 3217 */
> Cheers,
> --
> Toru Maesaka <d...@torum.net>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~drizzle-discuss
> Post to     : drizzle-discuss@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~drizzle-discuss
> More help   : https://help.launchpad.net/ListHelp
>
>

I am also frequently confused by this and wish that the use of bool
was limited to functions that were obviously assertions about state
(is_foo(), has_bar()) so that TRUE/true was never used for errors.


-- 
Mark Callaghan
mdcal...@gmail.com

_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to     : drizzle-discuss@lists.launchpad.net
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help   : https://help.launchpad.net/ListHelp

Reply via email to