> Is the following syntax legal in D4 and above. The D3 compiler refuses to
> compile it.
> 
> for (i := 0 to Pred(RegionList.Items.Count)) do
> 
> ' := found but ) expected

I expect the parser is told to expect something like

for EXPRESSION := EXPRESSION to EXPRESSION do STATEMENT

and then the Symbol table lookup is used to check if the first expression is a
valid loop variable... And expression will be something like

EXPRESSION
    ( EXPRESSION )
EXPRESSION
    EXPRESSION + EXPRESSION
EXPRESSION
    EXPRESSION - EXPRESSION
...

Since you started an expression with '(' it's looking for the closing ')' prior to
finding the ':='.. hence the error...

They should have specified

for IDENTIFIER := EXPRESSION to EXPRESSION

since all loop iterators have to be local variables (you can't use an array element or
dereferenced pointer can you?)...

--
Aaron@home


---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to