Jump to content

File Handles - local scope


steve8tch
 Share

Recommended Posts

If a handle is declared locally - should it be destroyed when that particular fuction call ends.

I have posted code here to illustrate the issue.

;open handles - local scope
$counter = 0
ProgressOn("OpenHandleInLocalScope test","Number of handles open  ", $counter, -1,-1,16)
While 1
    $counter += 1
    ProgressSet(0,$counter)
    OpenHandleInLocalScope()
    sleep(50)
WEnd

Func OpenHandleInLocalScope()
    local $h_x = FileOpen("C:\OpenHandleInLocalScope.txt",1)
EndFunc

At present the handle does NOT get destroyed on function exit, but should it?

Link to comment
Share on other sites

It would be a lot of work because it would require making a new "type" inside the Variant. Also, AutoIt isn't an object-oriented language so I'm not so sure how an RAII concept would fit.

Just curiosity what is RAII?
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...