Page 2 of 2

Posted: Fri Jul 20, 2007 7:56 am
by lionel_om
Pupil wrote:
lionel_om wrote: But with using "*mem\s = *str\s", PB made the copy and create a new buffer . Or I'm wrong...?
No, you're quite right.
PB's way of handling the '@' operator for strings can be a bit confusing at times. :) As you can se from the different answers you're getting ;)
So my procedure is quite good, excepted the null pointer case ?!

Code: Select all

Procedure.l V__Constructor_String(*param = #Null)
  Protected *str.String, *mem.String
  *mem = Vector__Allocate(SizeOf(String))
  If *param
    *str = @*param
    *mem\s = *str\s
  Else
    *mem\s = ""
  EndIf
  ProcedureReturn *mem
EndProcedure
So the problem came from another place ?! :?

Posted: Fri Jul 20, 2007 10:36 am
by Pupil
lionel_om wrote: So my procedure is quite good, excepted the null pointer case ?!

So the problem came from another place ?! :?
Yes i think the procedure is just fine, so there might be another problem somewhere in the code. One thing i wonder though, how is the result from the string constructor procedure handled?

Posted: Fri Jul 20, 2007 4:07 pm
by lionel_om
Pupil wrote:
lionel_om wrote: So my procedure is quite good, excepted the null pointer case ?!

So the problem came from another place ?! :?
Yes i think the procedure is just fine, so there might be another problem somewhere in the code. One thing i wonder though, how is the result from the string constructor procedure handled?
The return is used has a pointer of a STRING structure :

Code: Select all

*a.STRING = CallMyFunction()

Posted: Sat Jul 21, 2007 11:22 am
by Pupil
That should be OK.

Sorry, i'm afraid you have to do some more bug hunting :(

Are you using any threads or are the code compiled into a DLL?

Posted: Sat Jul 21, 2007 11:31 am
by lionel_om
Pupil wrote:That should be OK.

Sorry, i'm afraid you have to do some more bug hunting :(

Are you using any threads or are the code compiled into a DLL?
Yeah, I'm using Threads, and the only way the program bug is in the Threaded functions. I hope that PB have no more bug with threads and strings.

PS : I'have checked "Thread safe" in compiler options.

Lio