[fpc-pascal] How to let compiler print waring for the dropped returned-vale

Jürgen Hestermann juergen.hestermann at gmx.de
Thu Jul 21 15:52:31 CEST 2011



ZHANG Dao-yuan schrieb:
> E.g.
>
>   function f0: boolean;
>   begin
>     f0:= false;
>   end;
> begin
>   f0;
> end;
> the returned value f0 is dropped.
> Compile it and the compiler won't print any warning.
Yes, of course. What do you expect? If you don't use the return value 
for any purpose it is dropped.


> Any modifier or cmd option can make the compiler print warning for 
> this case?
> (my compiler is 2.4.5 x86_64 Linux)
>
Yes, there is a compiler switch that lets the compiler show an error 
when not using function return values. But I don't have it at hand now. 
Just look into the documentation.



More information about the fpc-pascal mailing list