[fpc-devel] Testing for..in feature

Alexander Klenin klenin at gmail.com
Tue Nov 3 23:06:08 CET 2009


On Wed, Nov 4, 2009 at 08:03, Thaddy <thaddy at thaddy.com> wrote:
> Alexander Klenin wrote:
>>
>> I have started testing the new for..in code.
>> The very first test I tried found a bug ;-)
>> ---
>> const S = 'abc';//<----???
>> var ch: Char;
>> begin
>>  for ch in S do Writeln(ch);
>> end.
>> ---
>>
>
> I suppose you refer to the fact that the compiler should never allow this ;)

I refer to the fact that iteration starts from position 0 instead of 1.
I think this is just a minor glitch in ShortString vs AnsiString detection.

> Or do you want this to actually work?? An untyped const is fine with me and
> I use it for years, but should it be allowed for for..in?

Do not see a reason why not.

-- 
Alexander S. Klenin



More information about the fpc-devel mailing list