On Tuesday 04 October 2005 15:39, Peter Lupton NCH Swift Sound wrote:
> 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.
I would say this case is a problem of microsoft's api, sometimes 0 means not 
good, and sometimes -1. (and it's always a macro). 
Besides HANDLE is integer. (as far as I recall)

I would give my own example of warning that should be an error, and it is not. 
This is not bool, but..
Recently in 2.6 kernels one of kmalloc's arguments has change its type. gcc 
only gives warning on that, while it should give an error. 

-- 
Vercetti

Reply via email to