Advanced note: local variable "i" is assigned but never used?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Advanced note: local variable "i" is assigned but never used?

vojtech.cihak
Hello,
 
would it be possible to do more advanced checking of this note? This code
 
var i: Integer;
begin
  i:=5;
end;        
 
gives Note: Local variable "i" is assigned but never used
 
var i: Integer;
begin
  i:=5;
  writeln('i ', i);
end;        
 
is OK
 
var i: Integer;
begin
  i:=5;
  writeln('i ', i);
  i:=7;
end;       
 
The last example is also accepted. It would be nice to have Note: Local variable "i" is assigned but never used too.
 
Thanks,

Vojtěch a.k.a. Blaazen
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Advanced note: local variable "i" is assigned but never used?

Juha Manninen
Try with flag -OoDFA

Juha
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Advanced note: local variable "i" is assigned but never used?

vojtech.cihak
In reply to this post by vojtech.cihak

It does not seem to do anything in latest FPC and Lazarus.

 

V.

______________________________________________________________
> Od: Juha Manninen <[hidden email]>
> Komu: FPC-Pascal users discussions <[hidden email]>
> Datum: 20.02.2018 14:34
> Předmět: Re: [fpc-pascal] Advanced note: local variable "i" is assigned but
>

Try with flag -OoDFA

Juha
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal