History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: IDEADEV-13071
Type: New Feature New Feature
Status: Open Open
Priority: Normal Normal
Assignee: Bas Leijdekkers
Reporter: Roman Elizarov
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
IDEA: Development

"Pointless arithmetic" inspection is too pointless in some case

Created: 08 Sep 06 19:30   Updated: 09 Jan 07 18:01
Component/s: Code Analysis. Inspection
Fix Version/s: None

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown

Build: 5,661
Severity: Medium


 Description  « Hide
Here is a real case of data structure. Assume that I put tripples of integers in array. And I call them VALUE, NEXT, and PREV. I declare the following constants:

static final int VALUE = 0;
static final int NEXT = 1;
static final int PREV = 2;
static final int COUNT = 3;

and the following methods:

int getValue(int[] a, int i) { return a[i * COUNT + VALUE]);
int getNext(int[] a, int i) { return a[i * COUNT + NEXT]);
int getPrev(int[] a, int i) { return a[i * COUNT + PREV]);

In getValue method IDEA compains that "+ VALUE" expression is pointless, since I'm adding just zero. It should not complain when I add a constant, since in the next version of the code I might change constants and VALUE shall becomes something other than zero.



 All   Comments   Work Log   Change History      Sort Order:
There are no comments yet on this issue.