On Wed, Sep 8, 2010 at 11:36 AM, Michael Widenius <monty@stripped> wrote:
>
> Hi!
>
>>>>>> "MARK" == MARK CALLAGHAN <mdcallag@stripped> writes:
>
> <cut>
>
> MARK> That isn't the problem. The problem is when I read frequently
> MARK> undocumented header files.
> MARK> my_bool do_this();
>
> MARK> The standard used by libc and others is to return an int with 0 as
> MARK> success and != 0 as an error. MySQL is the only system on which I have
> MARK> worked that uses bool and my_bool for this.
>
> In other words, the standard is to return TRUE for errors and FALSE
> for success, which you found confusing earlier.
No. The standard is to return 0 for success, and something other than
0 for errors. Mark was pretty clear about that.
In all C code I've worked with, the program defines some constant such
as SUCCESS to be 0 and then non-zero returns are constants
representing error codes. MySQL returning TRUE as 0 and FALSE as 1 is
the ONLY system I've ever seen that does that (tries to have an
unsigned char behave like C++'s bool type). And that is why there is
a complaint that it is non-standard.
Regards,
jay
| 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 |