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

Graeme Geldenhuys graeme at mastermaths.co.za
Fri Nov 20 10:45:35 CET 2009


Martin wrote:
> 
> If you use events you can not remove the parameters from your procedure 
> declarations, so you get that hint...; Not that it bothers me, but if 
> you got an easy solution...

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

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.


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! Then we don't have to change
these settings for each and every project. Icons, manifest files, .rc
files etc in Project Options is another BIG annoyance for me.


Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/




More information about the fpc-pascal mailing list