Menu

#1010 REDIM syntax bug in working version 1.20, for a procedure pointer array member and its access via pointer

open
nobody
None
compiler
2024-12-01
2024-12-01
No

Only for a procedure pointer array member and the REDIM instruction, accessing the array name via an instance pointer does not work anymore since the working-version 1.20 ("syntax error").
That works with the last official version 1.10.
No problem with LBOUND/UBOUND or ERASE.

Example:

Type UDT
    Dim As Integer i(Any)
    Dim As Sub() s(Any)
End Type

Dim As UDT u : Dim As UDT Ptr pu = @u

Redim u.i(0)
Redim u.s(0)

Redim pu->i(0)
Redim pu->s(0)    '' error 17: Syntax error, found '(' in 'Redim pu->s(0)' (with fbc version 1.20)
Redim (pu->s)(0)  '' error 17: Syntax error, found '(' in 'Redim (pu->s)(0)' (with fbc version 1.20)

Workaround from UDT pointer only:

With *pu
    Redim .i(0)
    Redim .s(0)
End With

Another workaround from UDT pointer only:

Dim Byref As UDT ru = *pu
Redim ru.i(0)
Redim ru.s(0)

Note:
'Redim (*pu).i(0)', 'Redim ((*pu).i)(0)', 'Redim (*pu).s(0)', and 'Redim ((*pu).s)(0)' do not work also (whatever fbc version).

See also from: https://www.freebasic.net/forum/viewtopic.php?p=305541#p305541

Discussion


Log in to post a comment.

MongoDB Logo MongoDB