[fpc-devel] Re: Testing for..in feature
Paul Ishenin
ip at kmiac.ru
Thu Nov 5 07:04:44 CET 2009
Alexander Klenin wrote:
>> 4) write 2 magic functions: one to get the next enum value, one to get the
>> previos enum value and implement a special handling in the for-in loop for
>> such arrays
>
> I always thought Succ/Pred are exactly such magic functions ;-)
Btw, I tested succ, pred with delphi and with fpc in mode delphi.
type
T = (a1, b1 = 5);
var
ch: T;
begin
ch := a1;
WriteLn(Ord(Succ(ch)));
end.
How do you think what is the output :) Answer: '1'
So succ/pred works another way we need.
Best regards,
Paul Ishenin.
More information about the fpc-devel
mailing list