[fpc-pascal] for-in loop cast

Sven Barth pascaldragon at googlemail.com
Thu Sep 26 19:34:29 CEST 2019


Ryan Joseph <genericptr at gmail.com> schrieb am Do., 26. Sep. 2019, 17:37:

> Question I’ve always had. Why do I need to cast “value” to “pointer"
> otherwise I get: Incompatible types: got "Pointer" expected “TObject”
> error?. I don’t find this very helpful and it doesn’t really make sense
> even.
>
> var
>   list: TObjectList;
>   value: TObject;
> begin
>   for pointer(value) in list do
>     ;
>

Aside from what Ben wrote I wonder whether such a cast should be able to
compile at all... 🤔

And we should probably add a proper TObject enumerator to TObjectList.

Regards,
Sven

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


More information about the fpc-pascal mailing list