Modify

#4103 new Bug

The expression in the array index was evaluated twice when assigning value

Reported by: anonymous Owned by:
Milestone: Component: AutoIt
Version: Severity: None
Keywords: Cc:

Description

Example code:

Local $i = -1
Func Inc()
	$i += 1
	ConsoleWrite("$i = " & $i & @CRLF)
	Return $i
EndFunc

Local $a[5] = [0, 1, 2, 3, 4]
$a[Inc()] = "Test"
_DebugArrayDisplay($a, $i)

The result in console:

$i = 0
$i = 1

The result of array display:

Row|Col 0
# 0|0
# 1|Test
# 2|2
# 3|3
# 4|4

The result of $i: 1

This bug only occurs when assigning value to the array ($a[Inc()] = "value"), but not when getting value ($value = $a[Inc()])

Attachments (0)

Change History (0)

Modify Ticket

Action
as new The ticket will remain with no owner.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.