[fpc-devel] Wrong docs: not initialized global variables
    Yuriy Sydorov 
    jura at cp-lab.com
       
    Wed Jul  4 12:08:47 CEST 2018
    
    
  
On 7/4/2018 12:09 AM, Florian Klämpfl wrote:
> Am 03.07.2018 um 22:57 schrieb Ondrej Pokorny:
>> Probably I am the only one who thinks that the code below is ridiculous...
>>
>>      procedure TExternalAssemblerOutputFile.AsmWriteFiltered(p: pchar; len: longint);
>>        var
>>          s: ansistring;
>>        begin
>>          MaybeAddLinePrefix;
>>          s:=''; // <<< ????
>>          setlength(s,len);
>>          move(p^,s[1],len);
>>          AsmWriteAnsiStringUnfiltered(decorator.LineFilter(s));
>>        end;
>>
>> ---
>>
>> I have split feelings: I really like to get the warning/hint at places where it makes sense so I don't want to disable 
>> it globally. But the amount of false positives increased significantly :/
> 
> The compiler is ~400k lines and I had to fix maybe 40 locations, so I wouldn't call this significantly and there are 
> situations where it matters, see the result case.
I'm not happy with this 'uninitialized' warnings for vars of managed types too.
Maybe it's worth to loosen the warning rule to prevent emitting warnings when an 'uninitialized' variable of a managed 
type (actually initialized) is passed as var parameter. Remove the warning or change it to a note in such case.
Yuriy.
    
    
More information about the fpc-devel
mailing list