Bug #12633

35 - '_z' declared but not used. Var used in condition not recognized.

Added by kju about 5 years ago. Updated about 5 years ago.

Status:Closed Start date:08/03/2010
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:-
Target version:1.0.0.36
Affected Version:

Description

ColumnHeader: Text: Error

 1 //-- CODEWINDOW
 2 // Called by        :    as code ref "AAS_AAS_MouseZChangedHandlerMainDisplay" in threads which need to re-initialise the UI 
 3 // Function area    :    game UI 
 4 
 5 // Description 
 6 // This keyhandler script acts on mouse wheel messages sent by the arma 
 7 // game engine and sets various variables. 
 8 
 9 #include "globalDefines.hpp" 
10 
11 private["_mouseWheelTurns","_numberOfMouseWheelTurns","_return","_z"]; 
12 
13 // ------------------ Parse Arguments ----------------- 
14 
15 int _mouseWheelTurns = _this select 1; 
16 int _numberOfMouseWheelTurns = (abs (_mouseWheelTurns)) / 1.2; 
17 
18 bool _return = false; 
19 
20 // ----------------------- Main Function --------------------- 
21 
22 if (gdtmod_hdr_dialog) then 
23 { 
24     private["_z"]; 
25     _z = (_mouseWheelTurns * (-1)); 
26     if ((_z / (abs _z)) < 0) then 
27     { 
28         if ((gdtmod_hdr_Value >= 0.51) && (gdtmod_hdr_Value <= 2)) then 
29         { 
30             gdtmod_hdr_Value = gdtmod_hdr_Value - (0.1 * _numberOfMouseWheelTurns); 
31         } 
32         else 
33         { 
34             if (gdtmod_hdr_Value > 2) then 
35             { 
36                 gdtmod_hdr_Value = gdtmod_hdr_Value - (0.5 * _numberOfMouseWheelTurns); 
37             }; 
38         }; 
39     } 
40     else 
41     { 
42         if ((gdtmod_hdr_Value >= 2) && (gdtmod_hdr_Value <= 99.5)) then 
43         { 
44             gdtmod_hdr_Value = gdtmod_hdr_Value + (0.5 * _numberOfMouseWheelTurns); 
45         } 
46         else 
47         { 
48             if (gdtmod_hdr_Value < 2) then 
49             { 
50                 gdtmod_hdr_Value = gdtmod_hdr_Value + (0.1 * _numberOfMouseWheelTurns); 
51             }; 
52         }; 
53     }; 
54     setAperture gdtmod_hdr_Value; 
55 }; 
56 //diag_log _this; 
57 //diag_log format ["%1",_numberOfMouseWheelTurns]; 
58 //diag_log _return; 
59 _return;

//-- ERRORWINDOW
Change/Insert 'private' array here?
'_z' declared but not used

//-- CURRENTERROR
// Called by        :    as code ref "AAS_AAS_MouseZChangedHandlerMainDisplay" in threads which need to re-initialise the UI 
// Function area    :    game UI 

// Description 
// This keyhandler script acts on mouse wheel messages sent by the arma 
// game engine and sets various variables. 

#include "globalDefines.hpp" 

private["_mouseWheelTurns","_numberOfMouseWheelTurns","_return","_z"]; 

// ------------------ Parse Arguments ----------------- 

int _mouseWheelTurns = _this select 1; 
int _numberOfMouseWheelTurns = (abs (_mouseWheelTurns)) / 1.2; 

bool _return = false; 

// ----------------------- Main Function --------------------- 

if (gdtmod_hdr_dialog) then 
{ 
    private["_z"]; 
    _z = (_mouseWheelTurns * (-1)); 
    if ((_z / (abs _z)) < 0) then 
    { 
        if ((gdtmod_hdr_Value >= 0.51) && (gdtmod_hdr_Value <= 2)) then 
        { 
            gdtmod_hdr_Value = gdtmod_hdr_Value - (0.1 * _numberOfMouseWheelTurns); 
        } 
        else 
        { 
            if (gdtmod_hdr_Value > 2) then 
            { 
                gdtmod_hdr_Value = gdtmod_hdr_Value - (0.5 * _numberOfMouseWheelTurns); 
            }; 
        }; 
    } 
    else 
    { 
        if ((gdtmod_hdr_Value >= 2) && (gdtmod_hdr_Value <= 99.5)) then 
        { 
            gdtmod_hdr_Value = gdtmod_hdr_Value + (0.5 * _numberOfMouseWheelTurns); 
        } 
        else 
        { 
            if (gdtmod_hdr_Value < 2) then 
            { 
                gdtmod_hdr_Value = gdtmod_hdr_Value + (0.1 * _numberOfMouseWheelTurns); 
            }; 
        }; 
    }; 
    setAperture gdtmod_hdr_Value; 
}; 
//diag_log _this; 
//diag_log format ["%1",_numberOfMouseWheelTurns]; 
//diag_log _return; 
_return
'_z' declared but not used
CODEBLOCK
 STATEMENT pos 0
  Binary operator =
   LHS
   VARNAME AAS_TestMission
   RHS
   Atom:true
 STATEMENT pos 1214
  Unary Operator private
   RHS
   ARRAY
    STRING"_mouseWheelTurns" 
    STRING"_numberOfMouseWheelTurns" 
    STRING"_return" 
    STRING"_z" 
 STATEMENT pos 15654
  Binary operator =
   LHS
   VARNAME _mouseWheelTurns
   RHS
   Binary operator select
    LHS
    VARNAME _this
    RHS
    NUMBER1
 STATEMENT pos 15752
  Binary operator =
   LHS
   VARNAME _numberOfMouseWheelTurns
   RHS
   Binary operator /
    LHS
    Bracketed
     Unary Operator abs
      RHS
      Bracketed
       VARNAME _mouseWheelTurns
    RHS
    NUMBER1.2
 STATEMENT pos 15813
  Binary operator =
   LHS
   VARNAME _return
   RHS
   Atom:false
 STATEMENT pos 15834
  Binary operator then
   LHS
   Unary Operator if
    RHS
    Bracketed
     VARNAME gdtmod_hdr_dialog
   RHS
   CODEBLOCK
    STATEMENT pos 15934
     Unary Operator private
      RHS
      ARRAY
       STRING"_z" 
    STATEMENT pos 15951
     Binary operator =
      LHS
      VARNAME _z
      RHS
      Bracketed
       Binary operator *
        LHS
        VARNAME _mouseWheelTurns
        RHS
        Bracketed
         Unary Operator -
          RHS
          NUMBER1
    STATEMENT pos 15985
     Binary operator else
      LHS
      Binary operator then
       LHS
       Unary Operator if
        RHS
        Bracketed
         Binary operator <
          LHS
          Bracketed
           Binary operator /
            LHS
            VARNAME _z
            RHS
            Bracketed
             Unary Operator abs
              RHS
              VARNAME _z
          RHS
          NUMBER0
       RHS
       CODEBLOCK
        STATEMENT pos 16021
         Binary operator else
          LHS
          Binary operator then
           LHS
           Unary Operator if
            RHS
            Bracketed
             Binary operator &&
              LHS
              Bracketed
               Binary operator >=
                LHS
                VARNAME gdtmod_hdr_Value
                RHS
                NUMBER0.51
              RHS
              Bracketed
               Binary operator <=
                LHS
                VARNAME gdtmod_hdr_Value
                RHS
                NUMBER2
           RHS
           CODEBLOCK
            STATEMENT pos 16093
             Binary operator =
              LHS
              VARNAME gdtmod_hdr_Value
              RHS
              Binary operator -
               LHS
               VARNAME gdtmod_hdr_Value
               RHS
               Bracketed
                Binary operator *
                 LHS
                 NUMBER0.1
                 RHS
                 VARNAME _numberOfMouseWheelTurns
          RHS
          CODEBLOCK
           STATEMENT pos 16187
            Binary operator then
             LHS
             Unary Operator if
              RHS
              Bracketed
               Binary operator >
                LHS
                VARNAME gdtmod_hdr_Value
                RHS
                NUMBER2
             RHS
             CODEBLOCK
              STATEMENT pos 16228
               Binary operator =
                LHS
                VARNAME gdtmod_hdr_Value
                RHS
                Binary operator -
                 LHS
                 VARNAME gdtmod_hdr_Value
                 RHS
                 Bracketed
                  Binary operator *
                   LHS
                   NUMBER0.5
                   RHS
                   VARNAME _numberOfMouseWheelTurns
      RHS
      CODEBLOCK
       STATEMENT pos 16333
        Binary operator else
         LHS
         Binary operator then
          LHS
          Unary Operator if
           RHS
           Bracketed
            Binary operator &&
             LHS
             Bracketed
              Binary operator >=
               LHS
               VARNAME gdtmod_hdr_Value
               RHS
               NUMBER2
             RHS
             Bracketed
              Binary operator <=
               LHS
               VARNAME gdtmod_hdr_Value
               RHS
               NUMBER99.5
          RHS
          CODEBLOCK
           STATEMENT pos 16405
            Binary operator =
             LHS
             VARNAME gdtmod_hdr_Value
             RHS
             Binary operator +
              LHS
              VARNAME gdtmod_hdr_Value
              RHS
              Bracketed
               Binary operator *
                LHS
                NUMBER0.5
                RHS
                VARNAME _numberOfMouseWheelTurns
         RHS
         CODEBLOCK
          STATEMENT pos 16499
           Binary operator then
            LHS
            Unary Operator if
             RHS
             Bracketed
              Binary operator <
               LHS
               VARNAME gdtmod_hdr_Value
               RHS
               NUMBER2
            RHS
            CODEBLOCK
             STATEMENT pos 16540
              Binary operator =
               LHS
               VARNAME gdtmod_hdr_Value
               RHS
               Binary operator +
                LHS
                VARNAME gdtmod_hdr_Value
                RHS
                Bracketed
                 Binary operator *
                  LHS
                  NUMBER0.1
                  RHS
                  VARNAME _numberOfMouseWheelTurns
    STATEMENT pos 16635
     Unary Operator setaperture
      RHS
      VARNAME gdtmod_hdr_Value
 STATEMENT pos 16671
  VARNAME _return

History

Updated by sbsmac about 5 years ago

  • Status changed from New to Feedback

Squint is correct here. If you look closely at the file it looks like

private [.. "_z"] ;

if (..)then{
private ["_z"];
...
};

The innermost _z is a different variable to the outer one (due the the inner private declaration) so the outermost variable is not actually being used at all. In other words, you could remove the outermost private statement.

Updated by sbsmac about 5 years ago

  • Target version set to 1.0.0.36

Updated by kju about 5 years ago

  • Status changed from Feedback to Closed

Ah yes; you are correct.

Unfortunately to do the issues with error context coloring,
I did not (still not) see the right context.

Updated by sbsmac about 5 years ago

Yes the context colouring for local variables and scope is pertty confusing in any case (even without the bug you are seeing) and I'm thinking of ways to make this report clearer.

Also available in: Atom PDF