What remains to be done?
In a reasonable world: merge the two questions.
In an utopia world: Join all answers in only one question, and select the best.
But not, we are not in that utopia world, not even in that reasonable world.
We are in stackexchange.
Both answers have been modified. Probably better now. A lot of misleading comments have been removed (well, some, others were put aside). But getting here from there included an edit war, a lot of commenting (a lot of which got erased by high rep users), Many interventions of the mods, strong arm twisting and a discussion on the chat.
All of that would have been avoided if the better (newer) question and answer had been selected as the one to keep, simple.
Is that fair with the questioner and the answer ? Of course it isn't.
A perfectly valid question, well written and specific to the issue to solve, got classified as a duplicate of:
Which, on a first look seems like an (also) reasonable question of a quite similar concern.
But, looking a bit deeper, it happens that both answers in that second question have troubling (and incorrect) issues and very conflicting comments about the order of evaluation of the
- The first answer (Archemar) claims that the negation
!is applied first and then the
- Gilles claims that that error is actually correct:
the incrementation is indeed applied after the value of the expression is calculated
- G-Man reinforces that interpretation under the cuonglm answer (the second answer).
!operator is applied to the value of
a[$0]before it is incremented
- And Gilles re-iterate the same in plain words:
This answer is wrong. The incrementation happens after the result of the ! operator is calculated.
At least, without taking any side, both answers result in confusion and noise.
Nobody has taken the time to address the problem and to make the answers clear, but yet, we are directing new questions to such conflicting answers.
Full disclosure: I do have a position. I believe that both G-man and Gilles are wrong. The only possible (valid) description is that the operator
++ is (as it must) be applied first to a lvalue and, ... later ... the
! operator is applied.
But the real issue to discuss here is: should we naively direct people to older answers that look (on first sight) the same but are fundamentally conflicting and confusing?
Note: this question has been written looking at what those answers look like NOW, they will probably be edited and changed. I, for one, will add another answer to try and address the (several) errors. Of course, after some time has passed to discuss this question.
I hold that we should keep to higher standards than ("first look" or "apparently similar").
What do we think?