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