From: MARK CALLAGHAN Date: October 18 2009 9:32pm Subject: Re: Coding style changes of 2009-06-26 now in the guidelines List-Archive: http://lists.mysql.com/internals/37384 Message-Id: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 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. I am fine with returning 1 or anything other than 0 on error. But '1' is an integer, not bool. I don't want functions that return 0 for success and 1 on error to return type bool. -- Mark Callaghan mdcallag@stripped