From: Michael Widenius Date: October 19 2009 10:05am Subject: Re: Coding style changes of 2009-06-26 now in the guidelines List-Archive: http://lists.mysql.com/internals/37386 Message-Id: <19164.14799.129393.355467@narttu.askmonty.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi! >>>>> "MARK" == MARK CALLAGHAN writes: MARK> On Sun, Oct 18, 2009 at 2:16 PM, Michael Widenius wrote: >> >> Hi! >> >>>>>>> "MARK" == MARK CALLAGHAN writes: >> >> >> >>>> Functions that only returns 0 or 1 should be bool or my_bool. >> MARK> I am being pedantic, but functions that return TRUE or FALSE can be MARK> bool/my_bool. A lot of MySQL source uses 0/1 in place of FALSE/TRUE MARK> for bool/my_bool which makes the code harder to read. >> MARK> I am not against using bool, I am against using it to return TRUE on MARK> error. The libc model is for functions to return type int with 0 on MARK> success and not 0 on error. I want the same to be done in MySQL. MARK> Predicate functions (has_a(), is_a()) can return type bool. >> >> In MySQL we are using relatively consistently 1 for errors. >> Changing it now, would not be practical. MARK> I am fine with returning 1 or anything other than 0 on error. But '1' MARK> is an integer, not bool. I don't want functions that return 0 for MARK> success and 1 on error to return type bool. Ok, I see your point. I am fine to addopt that new code for bool/my_bool function should return TRUE or FALSE. Regards, Monty