You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In QB45, all three of these result in the string being passed by value to the sub rather than by reference, however in QB64 the original string is passed in all three cases:
foobar(a$)foobar(a$+"")foobara$+""
It seems like the main culprit is that the parens or modifications don't trigger the string to get copied, so in the end it just passes the regular qbs pointer.
In the case of adding + "", qbs_add() contains short circuiting logic that just returns one of the passed strings directly if the other is length zero. That's not necessarily an issue by itself, but it means string modifications are not a guarantee of getting a copy.
In QB45, all three of these result in the string being passed by value to the sub rather than by reference, however in QB64 the original string is passed in all three cases:
It seems like the main culprit is that the parens or modifications don't trigger the string to get copied, so in the end it just passes the regular qbs pointer.
In the case of adding
+ ""
,qbs_add()
contains short circuiting logic that just returns one of the passed strings directly if the other is length zero. That's not necessarily an issue by itself, but it means string modifications are not a guarantee of getting a copy.Reported on the forum here: https://qb64phoenix.com/forum/showthread.php?tid=559
The text was updated successfully, but these errors were encountered: