On Thursday 29 September 2016 10:49:03 Graeme Geldenhuys wrote:
> On 2016-09-29 06:42, Martin Schreiber wrote:
> >  abcintf:= iabc(abc);
> > "
> > which has the best performance.
>
> But you must still remember to check if abcintf has been successfully
> assigned.
>
There will be a compiler error if "abc" does not implement "iabc".

> [personal opinion]
> Hence I still prefer the Supports(..) call as it can be used directly in
> a boolean expression, the name itself makes it very clear what you are
> asking from the code, and it just reads better.
>
Step through the code with F7 and you will see what overhead it means. AFAIK 
the compiler does not optimise for compiletime known case.

Martin
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to