Author Topic: Has the issue with GET\PUT using Fixed Strings been addressed lately?  (Read 3749 times)

0 Members and 1 Guest are viewing this topic.

Offline Cobalt

  • QB64 Developer
  • Forum Resident
  • Posts: 878
  • At 60 I become highly radioactive!
    • View Profile
So I can stop running into this:

In file included from qbx.cpp:2185:
..\\temp\\main.txt: In function 'void SUB_SAVE_IT(qbs*)':
..\\temp\\main.txt:3329:137: error: lvalue required as unary '&' operand
 sub_put(qbr(*_SUB_SAVE_IT_SINGLE_F),NULL,byte_element((uint64)(&(qbs_new_fixed(&((uint8*)(__ARRAY_STRING255_DIALOGS[0]))[(0)*255],255,1))),(255*(__ARRAY_STRING255_DIALOGS[2]&1)*__ARRAY_STRING255_DIALOGS[5])-(255*(0)),byte_element_118),0);
compilation terminated due to -Wfatal-errors.

Granted after becoming radioactive I only have a half-life!

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: Has the issue with GET\PUT using Fixed Strings been addressed lately?
« Reply #1 on: November 30, 2021, 11:53:21 am »
I think @SMcNeill had mentioned it several months ago with a possible fix but I think it broke other things.
Shuwatch!

FellippeHeitor

  • Guest
Re: Has the issue with GET\PUT using Fixed Strings been addressed lately?
« Reply #2 on: November 30, 2021, 12:04:25 pm »
You don't mention what version of QB64 you're using there, Cobalt. Is it the latest?

FellippeHeitor

  • Guest
Re: Has the issue with GET\PUT using Fixed Strings been addressed lately?
« Reply #3 on: November 30, 2021, 12:06:38 pm »
Also, if you can, please provide a minimal reproducible sample snippet we can use to check the issue.


FellippeHeitor

  • Guest
Re: Has the issue with GET\PUT using Fixed Strings been addressed lately?
« Reply #5 on: November 30, 2021, 12:40:33 pm »
That's a good example of why reporting issues in the forum alone and not creating an issue in the repository is prone to leave bugs behind.

https://github.com/QB64Team/qb64/issues/new/choose

Offline Cobalt

  • QB64 Developer
  • Forum Resident
  • Posts: 878
  • At 60 I become highly radioactive!
    • View Profile
Re: Has the issue with GET\PUT using Fixed Strings been addressed lately?
« Reply #6 on: November 30, 2021, 01:32:13 pm »
You don't mention what version of QB64 you're using there, Cobalt. Is it the latest?

Well it was more of an open-ended question. but yes latest build(stable) 2.0.2

Code: QB64: [Select]
  1. DIM A(255) AS STRING * 255
  2.  
  3. OPEN "TEST.TXT" FOR BINARY AS #1
  4.  
  5. PUT #1, , A() 'GET #1 causes the same issue
  6.  
  7.  

That's a good example of why reporting issues in the forum alone and not creating an issue in the repository is prone to leave bugs behind.

But you know how much GIT loves me. *sarcasm sarcasm*
I will see if it will allow me to though.

It's been discussed before a few times, looks like:

That is true, but yet no definitive repair was presented. And while the simple FOR\NEXT approach works, its just an inconvenience to have to when other data types don't need such excess code to be saved or read.
Granted after becoming radioactive I only have a half-life!

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: Has the issue with GET\PUT using Fixed Strings been addressed lately?
« Reply #7 on: November 30, 2021, 02:51:25 pm »
Yeah, like I was saying; I know Steve had discussed a fix in the C++ code but I don't think it was going to work out in the long term. I want to say I've seen Luke talk about it in the Discord as well but I don't know what ended up happening with that.
Shuwatch!

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Has the issue with GET\PUT using Fixed Strings been addressed lately?
« Reply #8 on: November 30, 2021, 03:00:51 pm »
Aye.  You can go in and alter the translated code in internal/temp manually with my "fix", but we can't push it into the repo as it breaks other things if applied across the board.  If I could sort out where in QB64 we generate the appropriate code for the c translation, I could probably write an IF condition to toggle translation between the two outputs, but I haven't had time (or honestly, motivation) to try and dig deep into the internals and push for the issue.

And for those who don't understand WHY this is such a complex bug to sort out, here's one  of the machine translated PUT statements:

sub_put( 1 , 1 ,byte_element((uint64)(&(qbs_new_fixed(&((uint8*)(__ARRAY_STRING1_B[0]))[(0)*1],1,1))),(1*(__ARRAY_STRING1_B[2]&1)*__ARRAY_STRING1_B[5])-(1*(0)),byte_element_1),1);

The issue is with a stray & in there.  Oddly enough, from what I remember with the issue, removing it fixes so we can PUT #1, , array(), but it breaks PUT #1, , array(element), which we can do now.

Which is why their needs to be a toggle in the output, but I'll be damned if I can sort out where to PUT it inside QB64's internals.
« Last Edit: November 30, 2021, 03:13:14 pm by SMcNeill »
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Cobalt

  • QB64 Developer
  • Forum Resident
  • Posts: 878
  • At 60 I become highly radioactive!
    • View Profile
Re: Has the issue with GET\PUT using Fixed Strings been addressed lately?
« Reply #9 on: November 30, 2021, 10:09:48 pm »
Is now a GItHub Issue.

#211
Granted after becoming radioactive I only have a half-life!

Offline George McGinn

  • Global Moderator
  • Forum Regular
  • Posts: 210
    • View Profile
    • Resume
Re: Has the issue with GET\PUT using Fixed Strings been addressed lately?
« Reply #10 on: November 30, 2021, 11:09:33 pm »
I posted a reply on GIT, but I wanted to place it here, just in case putting it in GIT was the wrong place to do so.

The code below does what you want it to, just replace the BINARY and PUT with OUTPUT and PRINT.

Code: QB64: [Select]
  1. DIM A(255) AS STRING * 255
  2. OPEN "File.tmp" FOR OUTPUT AS #1
  3. FOR I = 1 TO 255
  4.     B$ = ""
  5.     FOR Z = 1 TO 255
  6.         B$ = B$ + "A"
  7.     NEXT Z
  8.     B$ = B$ + "ZZZZZ"
  9.     A(I) = B$
  10.     PRINT #1, A(I)
____________________________________________________________________
George McGinn
Theoretical/Applied Computer Scientist
Member: IEEE, IEEE Computer Society
Technical Council on Software Engineering
IEEE Standards Association
American Association for the Advancement of Science (AAAS)

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: Has the issue with GET\PUT using Fixed Strings been addressed lately?
« Reply #11 on: December 05, 2021, 12:51:05 pm »
@SMcNeill
It is very impressive how so far from human language is that translation!
So our translator into C++ is not a real translator to pure C++ but a script writer that translate QB64 code into script calling  BAS. CPP library.

I hope and pray for all you developers that Rob has left you a map of his library.
It is hard to walk blind in the city!
Good luck boys.
Programming isn't difficult, only it's  consuming time and coffee