From: Michael Widenius Date: October 20 2009 11:25pm Subject: Re: Coding style changes of 2009-06-26 now in the guidelines List-Archive: http://lists.mysql.com/internals/37418 Message-Id: <19166.18131.655093.170078@narttu.askmonty.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Hi! >>>>> "MARK" =3D=3D MARK CALLAGHAN writes: MARK> On Mon, Oct 19, 2009 at 12:01 AM, Ingo Str=FCwing wrote: >> Hi Mark, >>=20 >> MARK CALLAGHAN, 17.10.2009 20:31: >>=20 >> ... >>> =A0 =A0 * =A0Functions should return zero on success, and non-zero = on error, >>> so you can do: >>>=20 >>> Can this be extended to state that these functions should return in= t >>> rather than bool/my_bool? Some functions today use bool/my_bool and= >>> return TRUE on error. I have to read the code for these to figure o= ut >>> whether TRUE is returned on error. >>=20 >> thanks for the suggestion. Is this a formal request to the MySQL Ser= ver >> coding style government committee? >>=20 >> http://forge.mysql.com/wiki/MySQL_Internals_Coding_Guidelines#How_we= _maintain_the_server_coding_guidelines >>=20 >> In this case, please add, what the implementation strategy should be= : >> Change all existing code, or let only new code follow the proposal. MARK> I don't expect existing code to be changed. But it would be nice = for MARK> people to slowly fix things when they edit code. My requests are:= MARK> 1) Use Unix style for functions (return type is int, 0 =3D=3D suc= cess). MARK> The current rule doesn't mention the return type. Do not use MARK> bool/my_bool for this with FALSE=3D=3Derrror and TRUE=3D=3Dsucces= s in place of MARK> 1. Having a mix of convention in the same code will just cause conflicts and is something that should be strongly discouraged MARK> 2) Use _Bool for my_bool on platforms that support C99 Having both _Bool and my_bool would make the code less portable. Better to stick with with my_bool as we are already using it all over the places. MARK> 3) Do not use the literals 0 and 1 in place of FALSE and TRUE Matter of style, but don't object to it (as long as no one uses this as an argument that FALSE should mean error). Regards, Monty