Acknowledged

SDK 4.2.1 Warning - Local variable "xxxxx" is not used...

This warning appears even if there is an assignment made to the variable in question.

If you believe the warning and simply delete the declaration for the variable, your code will crash at runtime due to the attempt to make an assignment to a variable that doesn't exist.

Is this the definition of the warning that is intended ??

I can see the value in a warning that indicates that the value from a variable is never used, indicating that you actually don't need the variable, but the warning as it currently works seems misleading to me.

Parents
  • Agreed... I just used it to clean up some lingering code from having diagnostics in place.

    That said, the variables are used in that there's an assignment made to them so I find the warning to be misleading and one has to look to see if the variable is actually being used in any way (an assignment to it) before deleting the declaration, or you get a crash at runtime.

    It's a hazardous warning in my opinion.

Comment
  • Agreed... I just used it to clean up some lingering code from having diagnostics in place.

    That said, the variables are used in that there's an assignment made to them so I find the warning to be misleading and one has to look to see if the variable is actually being used in any way (an assignment to it) before deleting the declaration, or you get a crash at runtime.

    It's a hazardous warning in my opinion.

Children
No Data