I can't say there was anything malicious or underhanded here. Four people reviewed it, three approved. The only reject, interestingly enough, was from the only person who has any significant rep in the Java tag. The three approvers also have just over 2k rep which means they're new to reviewing edits in general. I would chalk the approval up to not understanding what the change actually meant to the code.
I disagree that it was correct to make the edit in the first place. I would have rejected the edit for this reason
clearly conflicts with author's intent
This edit deviates from the original intent of the post. Even edits that must make drastic changes should strive to preserve the goals of the post's owner.
What the defenders of the edit are missing is that the changing of the number changed the meaning. That it was named primes
is NOT irrelevant. Good code always seeks to name variables with some sort of meaning as to what the variable means or contains. Whether or not the editor found it confusing, he should not have edited it as he did. 4
is clearly not a prime number.
The final nail in the coffin here is that this post was 6 years old. Nobody else found it confusing enough to edit it or even post a comment (and the original poster is the OP of this thread so he's active). If the editor found it that confusing he should have asked another question, referencing this answer.
changed the second spot in array from 3 to 4 because it makes the point more clear that we're moving forward a spot in memory, not incrementing the value
. It seems to me like a valid edit to clarify the example.primes
. At best, this is changing the intent of an answerer, which is not what edits should do. Any code edit should be reviewed stringently, and these reviewers did not do their job.int
with a value of2
change to3
because of a++
would think that perhaps it was because the value was incremented. Examples speak louder than words, and this example was ill-contrived.*(intPointer+1)
and(*intPointer)+1
are both equal to3
making it ambiguous what has happened. Using any number other than 3 removes the ambiguity.2
->3
could be mistaken for incrementing. Your post didn't show results beyond3
before.