An exception is not a normal function return. Instead of just returning with
a particular result, an exception will cause the stack to be unwound, and
control passed to exception handlers. So your False value will not be
returned if there is an exception. Delphi is thus quite right in warning you
the value is unnecessary.
Regards,
Andrew Cooke.
> -----Original Message-----
> From: Alex Kouznetsov [SMTP:[EMAIL PROTECTED]]
> Sent: Wednesday, March 01, 2000 8:40 AM
> To: Multiple recipients of list delphi
> Subject: [DUG]: Default boolean result and hints
>
> If function returning boolean does not set returned value, would the
> result
> be unpredictable or always FALSE. I assume it is unpredictable and use
> this
> simple technique.
>
> begin
> result := false;
> // do my stuff which may through exception
> // in this case FALSE will be returned
> // at the end of all
> result := TRUE;
> end;
>
> This is fine to me but Delphi gives me a kind hint that Value assigned to
> Result (first operator) never used. I do not like to see anything in my
> output window.
>
> ???
>
>
> --------------------------------------------------------------------------
> -
> New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz