Neven,

I agree with Paul but I have to say that even from a stylistic point of view
it isn't simply a matter of personal preference. IMHO stylistically speaking
any piece of code which deliberately causes an access violation (even a
handled one) has got to be bad!

Not to mention the fact the try except version of the code will make
debugging a nightmare as Delphi will be continually be stopping at these
points (unless you turn off stop on delphi exceptions in which case you are
loosing a valuable debugging tool).

David.

> Hi all
>
> If you are following a trail of properties, ie
Datasource.DataSet.Connection
> is it be to test for assignment/nil a each step or
> just try except it?
>
> ie
>   if (Datasource <> nil) and
>      (Datasource.DataSet <> nil) and
>      (Datasource.DataSet.Connection <> nil)
>   then Result := Datasource.DataSet.Connection
>   else Result := nil;
> or
>
> try
>   Result := Datasource.DataSet.Connection
> except
>   Result := nil
> end;
>


---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to