Author Topic: Compilation failed, log shows PUT fixed length string array  (Read 4967 times)

0 Members and 1 Guest are viewing this topic.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Compilation failed, log shows PUT fixed length string array
« Reply #15 on: March 02, 2021, 07:22:34 pm »
Dug a little deeper into this issue -- it's a problem which is a little beyond my pay grade.

Down around line 24800 in FUNCTION refer$, you'll see this bit of code:
Code: QB64: [Select]
  1.         IF (typ AND ISSTRING) THEN
  2.             IF (typ AND ISFIXEDLENGTH) THEN

IF we change what's after that to the following, we then have GET and PUT working properly with fixed length strings:
Code: [Select]
                offset$ = "((uint8*)(" + n$ + "[0]))[(" + a$ + ")*" + str2(id.tsize) + "]"
                r$ = offset$

The problem with this, however, is that we then end up breaking other things, where we reference the array by individual elements.  Stuff like array(1) = "H" will give us the c++ compilation failure.

Seems to me that we need two different outputs here -- one for when the array is indexed (X(1), for example) vs one for the whole array (which would be X(), from the previous example).

I'm not proficient enough in c to sort out exactly what has to be done to get this to work in both cases here, so I'll pass off the baton at this point and leave it up to someone else to carry us over the finish line. 

I can make GET/PUT work, *OR* I can have arrays work with indexes (as it currently exists), but I can't make it do both.  :P
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline NOVARSEG

  • Forum Resident
  • Posts: 509
    • View Profile
Re: Compilation failed, log shows PUT fixed length string array
« Reply #16 on: March 07, 2021, 12:55:17 am »
Related to this thread.


Quote
DIM X AS INTEGER
DIM B(3) AS STRING * 1

B() = "ABCD"


FOR X = 0 TO 3

    PRINT B(X)

NEXT X

So the compiler is saying that B() = B(0)  ???