Are there plans to fix my_bool?
It has been quiet on internals so I figured I would ask.
On Thu, Aug 26, 2010 at 6:16 AM, Guilhem Bichot
<guilhem.bichot@stripped> wrote:
>
> Hello,
>
> http://forge.mysql.com/wiki/MySQL_Internals_Coding_Guidelines
> says
>
> "Use TRUE and FALSE instead of true and false in C++ code. This makes the code more
> readable and makes it easier to use it later in a C library, if needed."
>
> Proposal 1
> ==========
> Use true/false, not TRUE/FALSE, for storing in into bool objects, or into bool
> function parameters. Do so for new code. Change existing code only when there's a deeper
> reason.
>
> Rationale
> =========
> I disagree with "more readable". I find that those capital letters are so
> eye-catching that they attract too much the reader's attention, for example when I read
> those lines (from 5.1) I pay more attention to TRUE that to "ref", which is bad:
>
> if
> ((*group->item)->walk(&Item::find_item_processor, TRUE,
>
> (uchar *) ref))
>
> having->split_sum_func2(thd, ref_pointer_array, all_fields,
>
> &having, TRUE);
>
> Also, I find it strange: "bool" can take "true" or "false" by design, why are we
> forced to use something else?
>
> Proposal 2
> ==========
>
> Extend proposal 1 to using true/false for storing into my_bool C function parameters,
> and to using bool for storing the my_bool result of C functions.
>
> Rationale
> =========
> TRUE/FALSE is needed for my_bool (which is char) in C code.
> As for calls to C functions from C++, if the function takes a my_bool parameter,
> passing true/false is ok, as there would be implicit conversion from bool to my_bool, true
> becomes 1 (==TRUE), false becomes 0 (==FALSE). Storing a my_bool result from the C
> function into a bool would also be correct (any non-zero value would become true). Thus it
> sounds possible to completely eliminate TRUE/FALSE from C++ code.
>
> --
> Mr. Guilhem Bichot <guilhem.bichot@stripped>
> Oracle / MySQL / Optimizer team, Lead Software Engineer
> Bordeaux, France
> www.oracle.com / www.mysql.com
>
> --
> MySQL Internals Mailing List
> For list archives: http://lists.mysql.com/internals
> To unsubscribe: http://lists.mysql.com/internals?unsub=1
>
--
Mark Callaghan
mdcallag@stripped
| Thread |
|---|
| • [STYLE] use true/false in C++, not TRUE/FALSE | Guilhem Bichot | 26 Aug |
| • Re: [STYLE] use true/false in C++, not TRUE/FALSE | Roy Lyseng | 26 Aug |
| • Re: [STYLE] use true/false in C++, not TRUE/FALSE | MARK CALLAGHAN | 26 Aug |
| • Re: [STYLE] use true/false in C++, not TRUE/FALSE | Guilhem Bichot | 31 Aug |
| • Re: [STYLE] use true/false in C++, not TRUE/FALSE | MARK CALLAGHAN | 31 Aug |
| • Re: [STYLE] use true/false in C++, not TRUE/FALSE | Guilhem Bichot | 31 Aug |
| • Re: [STYLE] use true/false in C++, not TRUE/FALSE | Jay Pipes | 31 Aug |
| • Re: [STYLE] use true/false in C++, not TRUE/FALSE | Davi Arnaut | 31 Aug |
| • Re: [STYLE] use true/false in C++, not TRUE/FALSE | Jay Pipes | 31 Aug |
| • Re: [STYLE] use true/false in C++, not TRUE/FALSE | Davi Arnaut | 31 Aug |
| • Re: [STYLE] use true/false in C++, not TRUE/FALSE | MARK CALLAGHAN | 31 Aug |
| • Re: [STYLE] use true/false in C++, not TRUE/FALSE | Davi Arnaut | 31 Aug |
| • Re: [STYLE] use true/false in C++, not TRUE/FALSE | MARK CALLAGHAN | 31 Aug |
| • Re: [STYLE] use true/false in C++, not TRUE/FALSE | Roy Lyseng | 31 Aug |
| • Re: [STYLE] use true/false in C++, not TRUE/FALSE | MARK CALLAGHAN | 31 Aug |
| • Re: [STYLE] use true/false in C++, not TRUE/FALSE | Michael Widenius | 8 Sep |
| • Re: [STYLE] use true/false in C++, not TRUE/FALSE | Jay Pipes | 8 Sep |
| • RE: [STYLE] use true/false in C++, not TRUE/FALSE | Vladislav Vaintroub | 31 Aug |
| • Re: [STYLE] use true/false in C++, not TRUE/FALSE | Roy Lyseng | 31 Aug |
| • Re: [STYLE] use true/false in C++, not TRUE/FALSE | Davi Arnaut | 31 Aug |
| • Re: [STYLE] use true/false in C++, not TRUE/FALSE | Michael Widenius | 8 Sep |
| • Re: [STYLE] use true/false in C++, not TRUE/FALSE | Davi Arnaut | 8 Sep |
| • RE: [STYLE] use true/false in C++, not TRUE/FALSE | Vladislav Vaintroub | 8 Sep |
| • Re: [STYLE] use true/false in C++, not TRUE/FALSE | Michael Widenius | 8 Sep |
| • Re: [STYLE] use true/false in C++, not TRUE/FALSE | Konstantin Osipov | 8 Sep |
| • Re: [STYLE] use true/false in C++, not TRUE/FALSE | Mats Kindahl | 8 Sep |
| • Re: [STYLE] use true/false in C++, not TRUE/FALSE | Tor Didriksen | 8 Sep |
| • Re: [STYLE] use true/false in C++, not TRUE/FALSE | Mats Kindahl | 8 Sep |
| • RE: [STYLE] use true/false in C++, not TRUE/FALSE | Vladislav Vaintroub | 8 Sep |
| • Re: [STYLE] use true/false in C++, not TRUE/FALSE | Mats Kindahl | 8 Sep |
| • Re: [STYLE] use true/false in C++, not TRUE/FALSE | Tor Didriksen | 8 Sep |
| • Re: [STYLE] use true/false in C++, not TRUE/FALSE | Mats Kindahl | 8 Sep |
| • Re: [STYLE] use true/false in C++, not TRUE/FALSE | Jay Pipes | 31 Aug |
| • Re: [STYLE] use true/false in C++, not TRUE/FALSE | Michael Widenius | 8 Sep |
| • Re: [STYLE] use true/false in C++, not TRUE/FALSE | MARK CALLAGHAN | 31 Aug |
| • Re: [STYLE] use true/false in C++, not TRUE/FALSE | Mats Kindahl | 27 Aug |
| • Re: [STYLE] use true/false in C++, not TRUE/FALSE | Michael Widenius | 8 Sep |