Hi,
I don't necessarily agree on using save actions or relying on the
JDT formatter so much but I think it would be good start to agree on
a coding style. Even if it's just on a wiki page, people will know
what to do and what to expect. The JDT formatter in the project
specific settings could be adjusted to the coding style (as much as
possible). Then if people want to use the JDT formatter to help them
conform to that coding style, they are free to do so.
Here is my opinion on the points mentioned so far:
1. Single statement with braces
I used to like to code without them but have given up on convincing
people that it's OK. Also, the iOS/OSX security bug is pretty
convincing. So I think using braces for single statement should be
mandatory and part of our coding style.
2. Right side comparison
I agree that it's unnatural.
3. Max line width
Anything more than 80 is fine with me.
4. Tab vs spaces
I would prefer spaces but don't have a strong opinion. As long as we
pick one.
In general, it would be nice if the CDT code was a bit more
consistent but I try not to turn down patches because of code style.
Committers can mention code style issues to educate contributors but
fix it themselves, depending on the situation.
Marc-André
On 2015-01-27 08:08 AM, Alena Laskavaia
wrote:
Sorry to bring this up again, but I want to
discuss this on cdt-dev.
Marc yet again -1'ed my commit because of code style,
specifically because not surrounding
a single statement with braces within if operator. First
of all I don't remember agreeing on any sort of code
style like that (see cdt process and code style wiki),
second of all I strongly disagree with this specific
one. Coding style like that was created I think 20 years
ago where people were
formatting code manually. Today everybody who works on
cdt code should use auto-formatter.
This should be the rule, not braces.
Adding more braces actually clutters the code leading to
lesser readability, and it affects all code not just "we
had a case 10 years ago when somebody formatted code
manually and it led to a bug".
I also strongly disagree with using code style with right
side comparison like (null == a). This was created again to
mitigate bad gramma of C language and it has no value in
Java. It greatly impairs readability because it is not a
natural order of english language, so people even they
understand it eventually will had hard time reading these
expressions.
Would be nice if we can actually agree of code formatting
style so we can add this to our save actions, so then we don't
have waste time dealing with code style and formatting on the
reviews.
Note if majority of committers will agree on certain style, even
I personally disagree with it I will follow it.
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/cdt-dev
|