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

ZHANG Dao-yuan 1123monkey at gmail.com
Thu Jul 21 16:11:07 CEST 2011


On 07/21/2011 09:52 PM, Jürgen Hestermann wrote:
>
>
> 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.

Thanks, I've found it. {$x-} or {$ExtendedSyntax off}



More information about the fpc-pascal mailing list