[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: difference between


Le 10/10/2026 à 14:45, Jussi Lahtinen a écrit :
Benoit, is it possible to make compiler check if boolean value is compared to NULL or any other non-boolean? Or rather if operator returning only boolean is checked against non-boolean?
It would catch bugs like in this thread.

Jussi


Strings and Objects are automatically converted to boolean. A void string and a null reference is FALSE, the others are TRUE.

As this is a feature I wanted, they are considered like booleans. Almost every datatype automatically converts to booleans.

I think the problem is more the 'Not' operator. Because of BASIC, there is no distinction like in C-like syntax between '!' (logical not) and '~" (binary complement).

Moreover, like valaquarus did, one forget that Not has a high priority, and that `If Not xxx = yyyy` is not `If Not (xxx = yyyy)`.

SO I'm not sure what kind of checks the compiler can do that would be reliable.

--
Benoît Minisini.


Follow-Ups:
Re: difference betweenJussi Lahtinen <jussi.lahtinen@xxxxxxxxx>
References:
difference betweenvalaquarus <valaquarus@xxxxxxxxx>
Re: difference betweenJussi Lahtinen <jussi.lahtinen@xxxxxxxxx>
Re: difference betweenJussi Lahtinen <jussi.lahtinen@xxxxxxxxx>
Re: difference betweenJussi Lahtinen <jussi.lahtinen@xxxxxxxxx>