[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: difference between
[Thread Prev] | [Thread Next]
- Subject: Re: difference between
- From: Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
- Date: Sat, 10 Oct 2026 16:13:20 +0200
- To: user@xxxxxxxxxxxxxxxxxxxxxx
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.
| Re: difference between | Jussi Lahtinen <jussi.lahtinen@xxxxxxxxx> |
| difference between | valaquarus <valaquarus@xxxxxxxxx> |
| Re: difference between | Jussi Lahtinen <jussi.lahtinen@xxxxxxxxx> |
| Re: difference between | Jussi Lahtinen <jussi.lahtinen@xxxxxxxxx> |
| Re: difference between | Jussi Lahtinen <jussi.lahtinen@xxxxxxxxx> |