Wishlish: GCC option for explicit booleans

Richard Guenther richard.guenther@gmail.com
Tue Oct 4 12:37:00 GMT 2005


On 10/4/05, Peter Lupton NCH Swift Sound <pl@nch.com.au> wrote:
> Maybe I gave a too simple example on my first post. Another example common
> error which would be prevented by blocking implicit bool conversion might be:
>
>     if (strcmp(szMyName, "Peter"))  printf("Hello Peter");
>
> This bad error currently just slips through. If we gave an option to only
> accept explicit bools then the error would be caught (because strcmp
> returns int not bool).

If you're that lazy programmer you're going to stick (bool) in front of it
to silence the warning.

Duh.

Richard.



More information about the Gcc mailing list