hint free [Re: [fpc-pascal] How to solve "variable does not seem to be initialized" compiler hint.]

Vincent Snijders vsnijders at vodafonevast.nl
Fri Nov 20 11:57:53 CET 2009


Graeme Geldenhuys schreef:
> 
> Another very annoying hint! :-)  Solution - apply yet more workarounds.
> FPC sure is verbal!

It is Friday again: To show that you are looking for problems with more than enough 
solutions ...

> 
> Option #1:
> ----------
>   procedure TForm.FormCreate(Sender: TObject);
>   begin
>     Assert(Sender <> nil); // or Sender = Sender or ....
>     ... your normal code here...
>   end;
> 
> Asserts are not enabled by default in Lazarus IDE projects, so that
> shouldn't generate any code, but it does shut the FPC compiler up from
> hinting like crazy.
> 

For you as Lazarus user there is another option:
Compiler options -> Verbosity -> uncheck Show hints for parameter "Sender" not used

> 
> Option #2:
> ----------
> If you are using FPC 2.4.0-rc1 or later, then you can disable specific
> compiler messages. "Project > Compiler Options > Messages tab". Then
> simply uncheck the messages you do not want. "Parameter not used" is
> just about always unchecked in my projects.
> 
> On only if Lazarus IDE support a "Save current settings as default for
> new projects", that would have been great! 

For this problem you can add the relevant option in your fpc.cfg. Use show compiler 
options to see what the relevant -vm option is.

Vincent



More information about the fpc-pascal mailing list