Extend Array Lengths

38 views
Skip to first unread message

Bob H

unread,
Sep 29, 2021, 9:00:57 AM9/29/21
to multisoft FlagShip
Using Flagship 7

I am creating a large array and at element #247 I get a
compiler error of this:

   ** Error: expression is too long (max 8192 bytes
   supported) myarray.prg(248): Syntax error, at character }

But if I end the array at element #246 and use this function:

   AADD(MyArray, 'XXXXXXXX, XxxxxxxxxxXxxxxxxxxxXxxxxxxxxxXx')

It seems that I can add, so far at least, as many new elements
as I need.  Is there a way to extend the number of elements in
the original array setup so I don't have to use the AADD() Function?

MyArray := {'AAAAAAAA, AaaaaaaaaaAaaaaaaaaaAaaaaaaaaaAa',;    && Element 01
                       ...
                      'WWWWWWWW,WwwwwwwwwwWwwwwwwwwwWwwwwwwwwwWw'}
&& Element 246

    AADD(MyArray, 'XXXXXXXX, XxxxxxxxxxXxxxxxxxxxXxxxxxxxxxXx')  && Element 247
                  ...
    AADD(MyArray, 'ZZZZZZZZ, ZzzzzzzzzzZzzzzzzzzzZzzzzzzzzzZz')  && Element 449

Thank you for your help.

Gerard

unread,
Sep 29, 2021, 9:30:21 AM9/29/21
to multisoft FlagShip
What size was the array when you first delclared it .

And I assume you tried using the aSize() function.

Paul

unread,
Sep 29, 2021, 9:58:26 AM9/29/21
to multisoft FlagShip
If you declare an array from constant/string, e.g.
  myarr := {{"elem1..."}, {"elem2..."}, {"elemX..."}}
the compiler limits the source input to 8 KB (= 100 lines per 80 chars) due to the limited stack/heap size. The same applies to the assignment of string constants. The remaining array elements can be added by AADD(...) as in your example - or by simple + addition for string assignments.

These restrictions do not apply to the dynamic variables in the application, where the limit is 2 GB.
Paul
Reply all
Reply to author
Forward
0 new messages