[fpc-pascal] Incorrect hint message ? ( Hint: Local variable "b" does not seem to be initialized" )

Skybuck Flying skybuck2000 at hotmail.com
Wed Aug 22 08:30:12 CEST 2007


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;

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. 




More information about the fpc-pascal mailing list