understanding that SearchRec has different formats for different OS targets, we've tried to use fillchar to initialize it to an empty record... unfortunately that does not remove the hint... instead the hint points to the fillchar line...
we do not want to turn off hints so how can we initialize dirinfo and make fpc happy?
[quote="os/2 ecs"]
Hint: Start of reading config file fpc.cfg
Hint: End of reading config file fpc.cfg
Free Pascal Compiler version 2.6.2 [2013/02/09] for i386 Copyright (c) 1993-2012 by Florian Klaempfl and others Target OS: OS/2
Compiling dirinfo.pas
dirinfo.pas(13,19) Hint: Variable "dirinfo" does not seem to be initialized Assembling test_searchrec
Linking dirinfo.exe
emxbind 0.9d -- Copyright (c) 1991-1997 by Eberhard Mattes Deleting *path*\projects\satsort\dirinfo.out
1 file deleted 335,872 bytes freed
16 lines compiled, 3.9 sec
3 hint(s) issued
[/quote]
[quote]="vista"]
C:\freepascal\projects\misc_projects>fpc -vhinw dirinfo.pas Hint: Start of reading config file fpc.cfg
Hint: End of reading config file fpc.cfg
Free Pascal Compiler version 2.7.1 [2013/12/05] for i386 Copyright (c) 1993-2013 by Florian Klaempfl and others Target OS: Win32 for i386
Compiling dirinfo.pas
dirinfo.pas(13,19) Hint: Variable "dirinfo" does not seem to be initialized Linking dirinfo.exe
16 lines compiled, 0.8 sec, 28304 bytes code, 1524 bytes data 3 hint(s) issued
[/quote]
[quote="dirinfo.pas"]
program test_SearchRec;
uses
Dos;
const
pattern : string = '*.pas';
var
dirinfo : SearchRec;
begin
fillchar(dirinfo,sizeof(dirinfo),$00);
FindFirst(pattern,AnyFile,dirinfo);
findclose(dirinfo);
end.
[/quote]