From: Michael Widenius Date: September 8 2010 3:40pm Subject: Re: [STYLE] use true/false in C++, not TRUE/FALSE List-Archive: http://lists.mysql.com/internals/38073 Message-Id: <19591.44640.153849.768553@narttu.askmonty.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi! >>>>> "Davi" == Davi Arnaut writes: Davi> On 8/31/10 2:51 PM, Vladislav Vaintroub wrote: Davi> C has a different rule, whereas there can be truncation. For example, a Davi> larger int might be truncated when converting to my_bool, resulting in a Davi> false. In this case you will get a warning from most compilers. Davi> Just say *no* to Boolean in C. I actually worry when I see a return type Davi> of my_bool and a return value other than TRUE/FALSE. Better stick with a Davi> simple int in C code. Which is a cause for creating more possiblity for errors not less. For example: my_bool foo() { return 5 }; int foo() { return 5 }; It's more clear that the first code example contains an error than the last one. Declaring a function to be my_bool will make it clear that one can't just change the function to return something else than 0 or 1 as those calling the function would not expect a value of '5'. Regards, Monty