Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
BUG: string sum optimization can return wrong result
Message
De
29/09/2005 17:16:23
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual FoxPro Beta
Titre:
BUG: string sum optimization can return wrong result
Versions des environnements
Visual FoxPro:
VFP 9
Divers
Thread ID:
01054699
Message ID:
01054699
Vues:
66
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform