[fpc-pascal] New Warnings with fpc >= 3.2.0

fredvs fiens at hotmail.com
Fri Mar 13 15:49:56 CET 2020


Hello Santiago.

> I supposse you are reading from a format that stores
> tabulatorkindty value as an integer

No, imho it was a bug, tabulatorkindty is a enumeration array and using
integer instead of a enum is not ok.

>  if (intValue>=ord(Low(tabulatorkindty))) and
> (intValue<=ord(high(tabulatorkindty)))
>           then Result:=tabulatorkindty(intValue)
>           else Result:=tak_none; 

Yes, this is the good solution for integer value in enum or if
tabulatorkindty was not initialized.

But in mse code, originally tabulatorkindty was initialized with:

---> kind := tabulatorkindty(-1); // not good coding

And now, with the last enum item added, the initialization is done with:

---> kind := tak_none;

So, imho, this can be used :

  if (kind <>  tak_none) then dosomething;

What do you think?

Fre;D










-----
Many thanks ;-)
--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/


More information about the fpc-pascal mailing list