Have you created a report in Quality Central for this?

http://qc.borland.com (borland clients)
http://www.alphalink.com.au/~jed/QC/ (my client)

JED

-----Original Message-----
From: Allan, Samuel [mailto:[EMAIL PROTECTED]
Sent: 1 June 2004 9:07 AM
To: NZ Borland Developers Group - Delphi List
Subject: RE: [DUG] Weird Delphi Warning


I've got another one that I found funny:

procedure Samuel([arguments]);
var
  bob: Integer;
begin
  ...
  if [condition1] then
    bob := 1
  else if [condition2] then
    bob := 2
  else if [condition3] then
    bob := 3
  else
    raise Exception.Create('error message');
  jim := bob + 10;
  ...
end;

gives the warning "Variable 'bob' might not have been initialized" on
the line "jim := bob + 10". Which is true, even though if bob has no
value then the exception will prevent that line of code from being run.
But, if you change the code to:

procedure Samuel([arguments]);
var
  bob: Integer;
begin
  ...
  bob := 0; // added this line to get rid of warning
  if [condition1] then
    bob := 1
  else if [condition2] then
    bob := 2
  else if [condition3] then
    bob := 3
  else
    raise Exception.Create('error message');
  jim := bob + 10;
  ...
end;

then you get a hint "Value assigned to 'bob' never used".

_______________________________________________
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi
_______________________________________________
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi

Reply via email to