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

Graeme Geldenhuys graeme at mastermaths.co.za
Fri Nov 20 09:42:16 CET 2009


Rainer Stratmann wrote:
> 
> But how do you solve the hints where a variable is initialised by a
> function call with a var in the parameters then?

:-) That the exact problem I have and the reason for this message thread.

In the due, I had to create a local work-around due to the fact that FPC
developers are not willing to fix/change the FPC FillChar() procedure.

I created a local dcpFillChar() which uses a out parameter. Inside the
implementation of dcpFillChar() I enabled {$HINTS OFF}, and then called
FPC's FillChar().

So for all structure that I do initialize, I have to use dcpFillChar().
If I forgot to initialize a typed structure before I use it, FPC will
still give me the Hint output. At which point I can find the location of
the offending code, and insert my call to dcpFillChar().

So I have a solution, but I consider it more a work-around that a 100%
solution. :-(  Either way, my code is working now and is hint free.
Important thing is that if a Hint does pop up, I only need to inspect it
once and solve the problem. The FPC will not complain about that code again.


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