Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

FalsePositive W509 with goto

 Post Reply Post Reply
Author
Sveinsson Kjaran View Drop Down
New Member
New Member
Avatar

Joined: 18 Nov 2016
Posts: 6
Post Options Post Options   Quote Sveinsson Kjaran Quote  Post ReplyReply Direct Link To This Post Topic: FalsePositive W509 with goto
    Posted: 18 Nov 2016 at 2:02pm
The following gives W509 unreachable code but if the result is put as the exit parameter then there is no warning.

function GoToError(const AValue: integer): double;
Label OnError;
begin
  if AValue = 0 then goto OnError;

  Result:= 1/AValue;
  exit;
//  exit(1/AValue);

OnError:
  Result:= 0;
  ShowMessage('Error');
end;
Back to Top
Roman Yankovsky View Drop Down
New Member
New Member
Avatar

Joined: 21 Jun 2016
Posts: 26
Post Options Post Options   Quote Roman Yankovsky Quote  Post ReplyReply Direct Link To This Post Posted: 18 Nov 2016 at 2:03pm
Nice catch! Will fix this.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down