It is currently Mon Sep 23, 2019 6:48 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Protected NOT protected?
PostPosted: Sat Jun 18, 2011 6:53 am 
Offline
Enthusiast
Enthusiast

Joined: Wed Aug 18, 2004 9:52 am
Posts: 425
Location: Penang, Malaysia
Tailbite 1.4.7 with PB 4.51.
Tailbite First.pb and Second.pb. Then run Third.pb. Seems that the protected variable alpha$ gets shared.

First.pb
Code:
Procedure$ First_Private(p1$)
  Protected alpha$ = ""
  alpha$ = p1$ + " first"
  ProcedureReturn alpha$
EndProcedure

ProcedureDLL$ First(p1$)
  ProcedureReturn First_Private(p1$)
EndProcedure


Second.pb
Code:
Procedure$ Seconds_Private(p1$)
  Protected alpha$ = ""
  alpha$ = p1$ + " second"
  ProcedureReturn alpha$
EndProcedure

ProcedureDLL$ Seconds(p1$)
  ProcedureReturn Seconds_Private(p1$)
EndProcedure


Third.pb
Code:
Debug First(Seconds("*"))   ; * second* second first

Procedure$ InFirst(p1$)
  Protected alpha$ = ""
  alpha$ = p1$ + " first"
  ProcedureReturn alpha$
EndProcedure

Procedure$ InSeconds(p1$)
  Protected alpha$ = ""
  alpha$ = p1$ + " second"
  ProcedureReturn alpha$
EndProcedure

Debug InFirst(InSeconds("*"))   ; * second first


Top
 Profile  
Reply with quote  
 Post subject: Re: Protected NOT protected?
PostPosted: Sat Jun 18, 2011 10:19 am 
Offline
Addict
Addict

Joined: Sat Apr 10, 2004 1:20 pm
Posts: 1143
Location: Germany
Its a known issue (the first one on the list) and has nothing to do with the protected keyword.


Top
 Profile  
Reply with quote  
 Post subject: Re: Protected NOT protected?
PostPosted: Sun Jun 19, 2011 9:43 am 
Offline
Enthusiast
Enthusiast

Joined: Wed Aug 18, 2004 9:52 am
Posts: 425
Location: Penang, Malaysia
Tanks for the feedback ABBKlaus. Do you know if 4.60 fixes this? :)


Top
 Profile  
Reply with quote  
 Post subject: Re: Protected NOT protected?
PostPosted: Sun Sep 11, 2011 11:06 am 
Offline
Enthusiast
Enthusiast

Joined: Wed Aug 18, 2004 9:52 am
Posts: 425
Location: Penang, Malaysia
Just retried this example with 4.60 RC1. This bug is not yet fixed... :(


Top
 Profile  
Reply with quote  
 Post subject: Re: Protected NOT protected?
PostPosted: Mon Sep 12, 2011 9:37 am 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat Apr 26, 2003 8:27 am
Posts: 4229
Location: Strasbourg / France
akee wrote:
Just retried this example with 4.60 RC1. This bug is not yet fixed... :(
It is not a PB bug, as PB libraries work fine.
It's a Tailbite issue (viewtopic.php?p=230189) related to the 'double PUSH dword [_PB_StringBasePosition]' in Purebasic.asm when a procedure returns a string.

_________________
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye