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.
Michael.
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal