Richard: based on your argument all type checking is for nought :).

But I have been going through other reports from the 'bug book' which I ask my programmers to log. Another case which explicit bools would solve would be (in Win32)...

        HANDLE hFile = CreateFile(...);
          if (!hFile) return;

If the compiler had forced the writer to make a real comparison, I am sure the bug would never have made it into release. The problem here is INVALID_HANDLE_VALUE is -1 not 0.


At 10:10 PM 4/10/2005, Richard Guenther wrote:
On 10/4/05, Peter Lupton NCH Swift Sound <[EMAIL PROTECTED]> 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.


Peter Lupton
[EMAIL PROTECTED]

NCH Swift Sound
Unit 13, Level 3
28 University Avenue
GPO Box 1169
Canberra ACT 2601
Australia
www.nch.com.au

Reply via email to