On Wed, 22 Aug 2007 08:30:12 +0200
"Skybuck Flying" <[EMAIL PROTECTED]> wrote:

> Hello,
> 
> The following hint message is displayed, which I doubt is correct
> which makes it interesting:
> 
> "project1.lpr(21,5) Hint: Local variable "b" does not seem to be 
> initialized"
> 
> Unfortunately the debugger is not working on my system, Lazarus does
> not have a disassembly view so I can't see what's going on at
> assembly level.
> 
> However when looking at the source code this hint message seems
> inaccurate.
> 
> B is initialized by the procedure test.
> 
> Demonstration/test program:
> 
> // *** Begin of Code ***
> 
> program project1;
> 
> {$mode objfpc}{$H+}
> 
> uses
>   {$IFDEF UNIX}{$IFDEF UseCThreads}
>   cthreads,
>   {$ENDIF}{$ENDIF}
>   Classes
>   { add your units here };
> 
> procedure test( var b : byte );
> begin
>     b := 5;
> end;
> 
> procedure useit;
> var
>     b : byte;
> begin
>     test( b );
> 
>     writeln( b );
> end;

It's a fpc message.
b is not initialized and given to 'var' parameter.
Either initialize b or change 'var' to 'out'.


Mattias


> 
> begin
>     writeln('program started');
> 
>     useit;
> 
>     writeln('press enter to exit');
>     readln;
> 
>     writeln('program finished');
> end.
> 
> // *** End of Code ***
> 
> I sent this message to free pascal and lazarus mailing lists because
> I am not sure which program is generating the hint message ?
> 
> (Free Pascal Compiler or Lazarus ?)
> 
> Me thinks FPC but I am not 100% sure ;)
> 
> Bye,
>   Skybuck. 
> 
> _________________________________________________________________
>      To unsubscribe: mail [EMAIL PROTECTED] with
>                 "unsubscribe" as the Subject
>    archives at http://www.lazarus.freepascal.org/mailarchives

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to