Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BUG: string sum optimization can return wrong result
Message
From
29/09/2005 17:16:23
 
General information
Forum:
Visual FoxPro
Category:
Visual FoxPro Beta
Title:
BUG: string sum optimization can return wrong result
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01054699
Message ID:
01054699
Views:
65
Expected: coherent behavior

Observed:
- with a 100 lengh string the result is correct ( optimization is not used )
- with a 101 lengh string the result is wrong
CLEAR

ON ERROR ?? MESSAGE()
x=REPLICATE('1',100)
?'A1 :'

X= x + CSTUFF(@x)

?? x && null  correct

x=REPLICATE('1',100)
?'A2 :'

X= x + CSTUFF1(@x)

?? x && '1...1333'  correct


x=REPLICATE('1',101)

?'B :'

X= x + CSTUFF(@x)

?? x && '4444'

x=REPLICATE('1',101)

?'C :'

TRY 
	X= x + CSTUFF1(@x) && ERROR
	?? x 
CATCH
	?? MESSAGE()
ENDTRY

x=REPLICATE('1',101)

?'D :'

X= x + CSTUFF(@x) + CSTUFF1(@x)

?? x && '5555'

PROCEDURE cstuff(sss)
	SSS = '4444'
	RETURN null
	
PROCEDURE cstuff1(sss)
	SSS = '5555'
	RETURN '333'
solution:
if the optimized variable has passed for reference
then
- or abandon the optimization
- or passes the variable by value
- or it produces an error
Next
Reply
Map
View

Click here to load this message in the networking platform