Ask Your Question
0

BASIC + Base : The first row of a 2D array is lost

asked 2020-06-08 12:18:57 +0100

lonk gravatar image

updated 2020-06-08 19:15:57 +0100

From the code in attached ods file. Can you please help describe why the first row of a 2D array is lost.

C:\fakepath\LostFirstRowOfArray.ods

C:\fakepath\firebird0011.odb

Edited: Additional sample file

C:\fakepath\LostFirstRowOfArray2.ods

edit retag flag offensive close merge delete

Comments

Can't follow the procedure right now (my insight in StarBasic scope, call conventions and such is a bit rusty, to say the least), but a few potential sources of error spring to mind:

  • Is gGrid initialized (dimensioned) before the first pass?
  • Could it be conflicting names for local and global variables?
keme gravatar imagekeme ( 2020-06-08 12:33:22 +0100 )edit

Dear @keme,

I have edited the question by only attaching another sample initializing each element of the array in simple way.

lonk gravatar imagelonk ( 2020-06-08 19:21:49 +0100 )edit

1 Answer

Sort by » oldest newest most voted
3

answered 2020-06-08 19:40:05 +0100

Jim K gravatar image

updated 2020-06-08 21:04:38 +0100

The following does not produce a message.

Sub SayHi
    If False Then Dim a
    MsgBox "hello"
End Sub

It looks to me like a bug in the Basic parser, because commands other than Dim and ReDim do not behave like this. Consider filing a bug report. If you do, add a comment here with a link to the bug number.

To fix the problem, close out the If statement fully.

Sub SayHi
    If False Then
        Dim a
    End If
    MsgBox "hello"
End Sub

In the future, please simplify your code as much as possible before posting. See guidelines for asking.

edit flag offensive delete link more

Comments

1

Dear @Jim K,

Noted with great thanks.

Bug number: TDF133811

lonk gravatar imagelonk ( 2020-06-09 09:36:44 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2020-06-08 12:18:57 +0100

Seen: 86 times

Last updated: Jun 08 '20