Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#3879 closed Bug (Fixed)

Dim doesn't change the type of Map to Array

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


Given a variable $v and for all AutoIt datatypes except Map, using Dim to change $v into an Array works fine.

Local $m[]		; a Map
Local $a[5]		; an Array

Local $types = [ _
	$m, _
	$a, _
	8, _
	8888888888888888, _
	"xyz", _
	Binary(12), _
	Ptr(555), _
	DllStructCreate("long"), _
	MsgBox, _
	_myFct, _
	ObjCreate("shell.application"), _
	Null, _
	True _

Func _myFct()

For $v In $types
	ConsoleWrite("$v declared as " & VarGetType($v) & @LF)
	Dim $v[3]
	ConsoleWrite("$v turned to a " & VarGetType($v) & @LF & @LF)

Dim is important when you get a ByRef variable of unknown type passed to a function, which you need to (re)turn into an Array loaded with data. It's even the only use case of Dim in AutoIt.

For a real-world use case where this can cause a serious bug, see

Attachments (0)

Change History (3)

comment:1 Changed 2 years ago by Jpm

  • Owner set to Jpm
  • Status changed from new to assigned

Fix sent to Jon

comment:2 Changed 2 years ago by Jon

  • Milestone set to
  • Owner changed from Jpm to Jon
  • Resolution set to Fixed
  • Status changed from assigned to closed

Fixed by revision [12733] in version:

comment:3 Changed 2 years ago by Jon

  • Milestone changed from to

Fixed by revision [12734] in version:

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

as closed The owner will remain Jon.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.