Sign in to follow this  
Followers 0
w0uter

Exit

9 posts in this topic

following snipet

Opt("MustDeclareVars", 1)
func exit2()
    Exit
EndFunc

$var = exit2()

it doesnt error while i did not declare $var, bug ?

dim $var = exit2()

gives an "Error in expression", bug ?

or is this intended. ifso how can i avoid this ?


My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll

Share this post


Link to post
Share on other sites



It looks like a bug to me.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Odd. ;)

I just tried the following with both the beta and the production version and got an error both times.

Opt("MustDeclareVars", 1)
func exit2()
    Exit
EndFunc
$Var=Exit2()

The error was as follows:

C:\Documents and Settings\Michael\Desktop\d.au3 (5) : ==> Variable used without being declared.:

$Var=Exit2()

^ ERROR

Edited by SolidSnake

HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Odd. ;)

I just tried the following with both the beta and the production version and got an error both times.

Opt("MustDeclareVars", 1)
func exit2()
    Exit
EndFunc
$Var=Exit2()

The error was as follows:

thats what its supposed to do.

try this:

Opt("MustDeclareVars", 1)
func exit2()
    Exit
EndFunc
Dim $Var=Exit2()

that should not error out.

Edited by theguy0000

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites

I have not seen "MustDeclareVars" preprocess declarations so since the script exits before $var is filled with a value then should AutoIt error? If you replace Exit with Return 1 then you get the declaration error or if you use Dim it works fine.

Share this post


Link to post
Share on other sites

It doesn't error in production version, only beta. I understand why it is a bug, but is a ret value expected when you send the exit keyword? No OnAutoItExit func is defined...


Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

Share this post


Link to post
Share on other sites

No, a return value isn't expected even if an OnAutoItExit() function is defined because control will not (or at least should not) return to the caller of the function in either case.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

It doesn't error in production version

I get an error in the production version on my pc as my post says above.

I am using the latest production version. (3.1.1.0)

Edited by SolidSnake

HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.

Share this post


Link to post
Share on other sites

using the following code, it only has an 'error in expression' for the beta, not the prod

Opt("MustDeclareVars", 1)
func exit2()
    Exit
EndFunc
Dim $Var=Exit2()

If you remove Dim and run the beta version, it does not error out, most likely because it processes exit2() before sending the return value to a variable, as I would expect.


Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

Share this post


Link to post
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
Sign in to follow this  
Followers 0