Forum Index
HomeZBasic Home   Forum RulesForum Rules   Forum FAQForum FAQ   MemberlistMemberlist   UsergroupsUsergroups   RSS FeedRSS Feed
Site SearchSite Search   LinksLinks   DownloadDownload   Digests and SubscriptionsDigests and Subscriptions
ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in   RegisterRegister
Function Return Optimization Bug

 
Post new topic   Reply to topic    Forum Index -> ZBasic Language
Author Message
mikep



Joined: 24 Sep 2005
Posts: 765
Location: Austin, TX

Posted: 23 December 2006, 16:24 PM    Post subject: Function Return Optimization Bug Reply with quote

The following example code shows the problem:
Code:
Private i as Integer
Private x as Byte

Sub Main()
   i = 20
   Debug.Print CStr(i)
   Call Func()
   ' Problem shows up with value of i is unchanged by call to Func
   Debug.Print CStr(i)
End Sub

Public Sub Func()
   i = SetCode()
   ' Uncomment the following line and Main prints the correct result
   'Debug.Print CStr(i)
End Sub

Function SetCode() as Integer
   SetCode = 3
   ' wrong code generated for line above (value not saved on stack)
   ' the following line is needed to see the problem
   x = 23
End Function

The two Debug.Print statements in Main() show the same value. Uncommenting the line in Func() shows the correct result of 20 and then 3.
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2493
Location: Portland, OR

Posted: 28 December 2006, 4:34 AM    Post subject: Reply with quote

The cause of this problem has been isolated and a solution has been implemented. It is currently in the process of being tested.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Forum Index -> ZBasic Language Time synchro. with the server - Timezone/DST with your computer
Page 1 of 1

 


All content Copyright © 2005-2012 Elba Corp. All Rights Reserved.
Opinions expressed in posts are those of the author and not necessarily those of Elba Corp.
Powered by phpBB © 2001, 2005 phpBB Group