Author Topic: Must not assign to a direct string param  (Read 1907 times)

0 Members and 1 Guest are viewing this topic.

Brian Alvarez

  • Guest
Must not assign to a direct string param
« on: May 07, 2018, 11:06:48 PM »

 Hello guys, What does this message mean:

"Must not assign to a direct string param"

 Thanks.


Brian Alvarez

  • Guest
Re: Must not assign to a direct string param
« Reply #1 on: May 08, 2018, 12:24:23 AM »
Charles, i am getting stuck with a bunch of pretty vague error descriptions.

Code: [Select]
; ASM ERR: lea edi,sss_buffer!!  Can't identify next operand '
 ; AFTER:    ._direct_
 ; LINE:    25

 I dont even see that in my code... Do you think you could use a few hours to describe a little more the errors? or explain where they come? I cant advance much with these speed bumps happening every few minutes. :(

JRS

  • Guest
Re: Must not assign to a direct string param
« Reply #2 on: May 08, 2018, 01:09:05 AM »
If Charles doesn't get feedback from real world developers like yourself, the chances of O2 becoming production stable anytime soon is debatable. My experience has been as soon as Charles hears about an issue, it is resolved withing 48 hours normally. With PowerBASIC you had to wait until the next maintenance release. (which could have taken up to a year)

I was serious when I said you're chewing on raw BASIC but the flavor is intoxicating.  :)

Trying to entertain users like Chris Chancellor is a waste of Charles's time if he wants a release of a BASIC compiler that's documented in his lifetime.

Charles Pegge

  • Guest
Re: Must not assign to a direct string param
« Reply #3 on: May 08, 2018, 02:24:52 AM »
Hi Brian,

"Must not assign to a direct string param"

This means you must not alter a direct string param, as it would destroy the caller's string. You can either pass the string byref, or assign to another string, which you can alter without affecting the caller's string.

In the second error, you have an unidentified symbol: sss_buffer which has fallen through to the assembler. This suggests, to me, that you are trying to redim an array/variable which has already been defined statically. Dynamic arrays have an associated _buffer.



Brian Alvarez

  • Guest
Re: Must not assign to a direct string param
« Reply #4 on: May 08, 2018, 03:27:38 AM »
Charles, in the first case i was doing:

Code: [Select]
StdOutText = RTRIM_(StdOutText, 0, CHR(0)) + LBC
 By direct string does it mean i cannot pass the variable being assigned with a value from StdOutText as a parameter of RTRIM_ even though it is being passed as BYVAL? Or that BYVAL parameters are read-only in oxygen basic?
would this help?:

Code: [Select]
StdOutText = RTRIM_(rtrim(StdOutText), 0, CHR(0)) + LBC
 The reason i am asking this, is that i am not altering LBC which is the only parameter that is a literal string. StdOutText is a STR(ubound(SSS, 1)).

 In the second case, i was testing the redim statement:

Code: [Select]
   DIM LONG sss[100]
   REDIM LONG sss[100]

 How can i do it without causing trouble?

 Thanks. :)




« Last Edit: May 08, 2018, 04:04:48 AM by Brian Alvarez »

Brian Alvarez

  • Guest
Re: Must not assign to a direct string param
« Reply #5 on: May 08, 2018, 03:32:13 AM »
If Charles doesn't get feedback from real world developers like yourself, the chances of O2 becoming production stable anytime soon is debatable. My experience has been as soon as Charles hears about an issue, it is resolved withing 48 hours normally. With PowerBASIC you had to wait until the next maintenance release. (which could have taken up to a year)

 Haha, it will just get worse. I usually test the most extreme circumstances.  I hope i dont tire everybody here. :P

Charles Pegge

  • Guest
Re: Must not assign to a direct string param
« Reply #6 on: May 08, 2018, 04:10:00 AM »
 ;D

The best and simplest solution is to use a new string inside your RTRIM_() procedure, and assign the first string param to it. o2 doesn't have an implict bycopy.


Dynamic arrays must be declared using redim from the start. You can create an empty array if you are not ready to allocate elements yet:

redim int a(0)

Brian Alvarez

  • Guest
Re: Must not assign to a direct string param
« Reply #7 on: May 08, 2018, 05:05:19 AM »
o2 doesn't have an implict bycopy.

 No problem, PluriBASIC does and can generate the code for oxygen. But it seems to be accepting the BYVAL switch. Is it just ignoring it?

Dynamic arrays must be declared using redim from the start. You can create an empty array if you are not ready to allocate elements yet:

redim int a(0)


Okay, no problem... but then how do i redim with no preserve and redim with preserve?

Aurel

  • Guest
Re: Must not assign to a direct string param
« Reply #8 on: May 08, 2018, 05:30:48 AM »
I get similar msg few days back but now seems that work  :o

Code: [Select]
'str = rtrim str
string StdOutText = "Oxygen "
StdOutText = RTRIM(StdOutText)
print StdOutText