Jump to content

AU3Check - declared, but not used in func - what I am doing wrong ?


Go to solution Solved by water,

Recommended Posts

Posted (edited)

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7

_main()
Func _main()
    Local $sSection_Function = ''
    $sSection_Function = '1'
EndFunc   ;==>_main

  Quote

 

>"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /beta /AU3Check /in "L:Testtest_Au3Check.au3"

+>09:42:10 Starting AutoIt3Wrapper v.2.1.4.2 SciTE v.3.3.7.0 ;  Keyboard:00000415  OS:WIN_7/Service Pack 1  CPU:X64 OS:X64    Environment(Language:0415  Keyboard:00000415  OS:WIN_7/Service Pack 1  CPU:X64 OS:X64)
>Running AU3Check (3.3.11.2)  params:-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7  from:C:Program Files (x86)AutoIt3Beta
"L:Testtest_Au3Check.au3"(5,31) : warning: $sSection_Function: declared, but not used in func.
Local $sSection_Function = ''
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
L:Testtest_Au3Check.au3 - 0 error(s), 1 warning(s)
->09:42:10 AU3Check ended. Press F4 to jump to next error.rc:1
>Exit code: 0    Time: 0.548
 

 

 

Edited by mlipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

  • Solution
Posted

Means: You assign a value to the variable but never use the variable.

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted
Indeed, it is logical.
 
/ /_

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

  • 8 years later...
Posted
  On 1/8/2014 at 8:48 AM, water said:

Means: You assign a value to the variable but never use the variable.

Expand  

Hi! Sorry for bumping old threads, but what you can say in this case? 

#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7

Opt('MustDeclareVars', 1)
__test()

Func __test()
    Local $aArray[15]
    Local $hGUI = GUICreate('', 200, 450)
    For $i = 0 To 14
    $aArray[$i] = GUICtrlCreateLabel('label_' & $i, 10, ($i * 25) + 10, 80, 21)
    Next
    Local $idBtn = GUICtrlCreateButton('Button', 10, 415, 180, 25)
    GUISetState(@SW_SHOW, $hGUI)
    While 1
        Switch GUIGetMsg()
            Case -3
                ExitLoop
            Case $idBtn
                MsgBox('64', '', $idBtn)

        EndSwitch
    WEnd
EndFunc   ;==>__test

AU3Check - $aArray: declared, but not used in func.

Ok, let's change string:

For $i = 0 To 14

to:

For $i = 0 To Ubound($aArray) - 1

 AU3Check - passed. 

imho - in this case we have a really fine line between "hold important data in variable"(control ID) and "used variable"

Posted

"Used" means: The array does not get read. Just assigning a value is not enough.

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

This condition isn't always strict. For instance in this code, the variable $a never gets actually used (read back at some point):

Local $a = 1

Inc($a)

Func Inc($v)
    $v += 1
EndFunc

In fact this source is equivalent to a fully empty script, doing exactly nothing except waste CPU cycles. But detecting such cases would need deep parsing, much harder to do and probably well beyond what Au3Check is aiming at.

  Reveal hidden contents

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

  • Developers
Posted
  On 6/22/2022 at 12:15 PM, jchd said:

probably well beyond what Au3Check is aiming at

Expand  

Yes correct...  it simply tries in a single lexing  pass to determine whether there are any obvious issues. 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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
×
×
  • Create New...