[fpc-pascal] fcl-passrc errors

Benito van der Zander benito at benibela.de
Tue Oct 15 23:26:24 CEST 2019


Hi,

On 14.10.19 15:44, Ryan Joseph wrote:
> var
>    it: pointer;
>    obj: TObject;
> begin
>    for it in list do
>      begin
>        obj := TObject(it);
>        // continue on like before using “obj” instead of “it"
>      end;
>
>
> That’s our realistic best use case now but it requires 2 extra steps. I hope there’s a better solution to keep the for-in loops as easy to use as before.

you could do

var
   it: pointer;
   obj: TObject absolute it;
begin
   for it in list do
     begin
       // continue on like before using “obj” instead of “it"
     end;


Cheers,
Benito

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20191015/ee7ecd79/attachment.html>


More information about the fpc-pascal mailing list