[fpc-pascal] New Warnings with fpc >= 3.2.0
Michael Van Canneyt
michael at freepascal.org
Wed Mar 11 13:03:44 CET 2020
On Wed, 11 Mar 2020, fredvs via fpc-pascal wrote:
>> Do it properly, and add a tab_None or somesuch
> If I may, I would prefer "somesuch" vs adding a new constant.
Of course you may. It is a free world.
> But, really, would it not possible to write the equivalent of
> if (kind <> tabulatorkindty(-1)) then
You can write it, but the compiler will warn you that -1 can never be a
correct tabulatorkindty value. And the compiler is correct in such matters.
That's the price you pay for using such "tricks". Pascal is a type-safe
language, and the compiler goes to great lengths to ensure you have correct data.
Here you deliberately try to trick the compiler with an invalid data value.
So, don't be surprised it complains...
You'll need to disable that particular warning if you want to use such tricks.
More information about the fpc-pascal