Modify

Opened 16 years ago

Closed 15 years ago

#1750 closed Bug (No Bug)

Au3Check misrepresents undefined Call as critical

Reported by: anonymous Owned by: Jos
Milestone: Component: Au3Check
Version: 3.3.6.1 Severity: None
Keywords: Cc:

Description

I searched for this issue, but I couldn't find it - even though I've seen it forever.

The Call documentation makes it clear that Call-ing an undefined function is not a critical (exiting) condition, and not necessarily an coding mistake.

However, when using a literal string for the function name, the Au3Check message implies that it is an coding mistake instead of taking into account that it is a valid operation to acquire the @error/@extended values for in-script handling.

The Call example avoids the issue at hand by using a variable to bypass/workaround Au3Check's conditions.

A modification of the example will prompt the Au3Check Error:

Call('DoesNotExist')
If @error = 0xDEAD And @extended = 0xBEEF Then MsgBox(4096, "", "Function does not exist.")

Aside from the actual report, my suggestions toward this specific issue which you can ignore at-will are:

  • Possibly change ERROR to WARNING to reflect the noncritical nature of the condition.
  • Failing that, Document the preference [in a sentence] for function variable/expression passing to evade Au3Check. (like the example shows) However, to me, it gets silly when you have to add extra code to an already-working script to bypass a message from the code-checker.

Maybe this is a non-issue, but I just think it misrepresents the Call function. I always thought (perhaps incorrectly) that Au3Check should anticipate AutoIt for ERRORs and give anything else helpful as WARNINGs, this seems to diverge from that a bit.

Attachments (0)

Change History (3)

comment:1 by J-Paul Mesnage, 16 years ago

I think Au3Check try to find real error.
If you really need such coding just use #ignorefunc DoesNotExist
or

$DoesNotExist ='DoesNotExist'
Call($DoesNotExist)
If @error = 0xDEAD And @extended = 0xBEEF Then MsgBox(4096, "", "Function does not exist.")

this coding reflect more why checking @error/@extended can be useful

comment:2 by anonymous, 16 years ago

I'm aware you can use rules to avoid the error, I just think ERRORing by-default on valid code is the mistake.

Au3Check assumes the code is an ERROR when it is valid AutoIt code. Since you're predicting a *possible* mistake it should be a WARNING. (like with other messages)

But this isn't a terribly important issue, so I'm not really insisting on anything if doing otherwise proves unreasonable.

Aside:
At least in my mind there's no reason to prefer the variable over the literal for ERROR-checking.

In practice though you can use the variable, but there can be conditions where it is not more compact to use a variable for each Call. (eg: checking several functions of the same utility with a unique number of arguments - it is more compact to Call the literal than to set the value to a variable for each Call)

PS: weird, tried to comment but it didn't append it.

comment:3 by Valik, 15 years ago

Resolution: No Bug
Status: newclosed

In my opinion, the code is questionable to begin with so I don't have a problem with an error being reported. I can think of very few circumstances where you would perform a Call() on a literal string where the function won't exist.

Modify Ticket

Action
as closed The owner will remain Jos.

Add Comment


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