In most IDEs, you can simply mouseover the variable if you want to know. In addition, really, if you're working in an instance method, you should really know all the variables involved. If you have too many, or their names clash, then you need to refactor.
It's really quite redundant.
I currently work at a place where a standard code format is enforced and the code is automatically formatted when saving the file, just like you are about to do. As a new member of the company I found that the common formatting rules gave me a warm and fuzzy feeling that "these guys know what they are doing", so I couldn't be happier. ;) As a related side note, with the common formatting rules we also enforce certain, rather strict compiler warning settings in Eclipse, with most of them set to Error, many set to Warning, and almost none set to Ignore.
I'd say there are two main reasons to enforce a single code format in a project. First has to do with version control: with everybody formatting the code identically, all changes in the files are guaranteed to be meaningful. No more just adding or removing a space here or there, let alone reformatting an entire file as a "side effect" of actually changing just a line or two.
The second reason is that it kind of takes the programmers' egos out of the equation. With everybody formatting their code the same way, you can no longer as easily tell who has written what. The code becomes more anonymous and common property, so nobody needs to feel uneasy about changing "somebody else's" code.
Those being the main reasons, there are others as well. I find it comforting that I don't have to bother myself with thinking about the code formatting, as Eclipse will do it for me automatically when I save. It's care-free, like writing documents with LaTeX: it's formatted afterwards and you don't have to worry about it while writing. I have also worked in projects where everybody has had their own styles. Then you have to think about stupid and meaningless issues such as if it's OK to modify somebody else's code in your own style, or if you should try to imitate their style instead.
The only argument against common code formatting settings that I can think of for your case is that it's apparently an already ongoing project, so it will cause lots of unnecessary changes in all the files, messing up the actual file histories. The best case scenario is if you can start enforcing the settings right from the beginning of a project.
Best Answer
You haven't specified the language, but in most C-like languages the value of an assignment is the value being assigned. That is, the value of the expression
x = 5
is5
, and the expression you're asking about is essentially the same as doing:There's no value in the extra assignment, so no reason to do it.
Now, what you do sometimes see is the assignment of two (or more) variables to some value at the same time, like this:
In this case, you're assigning 5 to
y
, and then assigning the value of that expression (again, 5) tox
. This ensures that bothx
andy
get the same value.Another possibility is that one of the assignments was intended to be a comparison, with the result assigned to the variable being compared:
This isn't a double assignment, it's assignment of the boolean expression
x == 5
tox
. That is, if the value ofx
is 5 before the expression,x
will get the value oftrue
(some non-zero integer); ifx
is not 5,x
will be set tofalse
(i.e. 0).