Jump to content

Pointer variables


Recommended Posts

Hi guys

Does Autoit support pointer variables, ie. variables that contain the memory location of other variables so that they can be used to pass arrays down to functions?

I looked at the PTR function, but that doesn't seem to be what I am looking for.

Thanks guys

Link to comment
Share on other sites

Hi guys

Does Autoit support pointer variables, ie. variables that contain the memory location of other variables so that they can be used to pass arrays down to functions?

I looked at the PTR function, but that doesn't seem to be what I am looking for.

Thanks guys

Hi!

In autoit you cannot access variables by their addresses, it's still easy to pass arrays to functions.

Example:

Local $arr[10 ^ 6]
For $i = 0 To UBound($arr) - 1
    $arr[$i] = $i
Next

$timer=TimerInit()
SlowArray($arr)
ConsoleWrite("Calling without ByRef took: "&@TAB&TimerDiff($timer)&" ms."&@CRLF)

$timer=TimerInit()
FastArray($arr)
ConsoleWrite("Calling with ByRef took: "&@TAB&TimerDiff($timer)&" ms."&@CRLF)

Func FastArray(ByRef $arr)
    
    
EndFunc  ;==>FastArray

Func SlowArray($ArrCopy)
    
EndFunc  ;==>SlowArray

ByRef in this case could be looked at as a pointer.

:)

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...