[fpc-pascal] New Warnings with fpc >= 3.2.0 (fredvs)

fredvs fiens at hotmail.com
Sat Mar 14 16:35:04 CET 2020


> And it's not initialized with the first item, but with 0.

Well said, indeed, that example (see tak_none := 1):

PROGRAM enumtest;

type
    tabulatorkindty =
(tak_none := 1,tak_left,tak_right,tak_centered,tak_decimal);
 
var
  kind: tabulatorkindty;
   
begin
    if kind = tak_none then
    WriteLn('OK it is tak_none')
  else WriteLn('No is is not tak_none') ;

   if kind = tabulatorkindty(0) then
    WriteLn('OK it is 0')
  else WriteLn('No is is not 0') ;
end. 

___________

Gives as result:

$ /home/fred/enumtest
> No it is not tak_none
> OK it is 0

And, cherry on the cake, now at compilation, there is that warning:

> Compiling /home/fred/weird/enumtest.pas
> enumtest.pas(10,8) Warning: Variable "kind" does not seem to be
> initialized

Hum, I feel to become a enum-guru.

Thanks Sven!

Fre;D



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


More information about the fpc-pascal mailing list