KurtEck
09-24-2015, 10:54 AM
Was wondering if we should try aiming toward some form of coding standards. Personally I don't think we need to go overboard here, but a few things might be nice. Hopefully I am not kicking a hornets nest ;)
One standard I know some are semi following now is that for ROS: http://wiki.ros.org/CppStyleGuide
Which might be nice to get to, but it might take a bit to get there.
In the mean time, there are some simple things we might want to think about, like:
End of lines - My last edit of a few of the files showed up like I changed every line. Turns out the file was previously saved with every line ending in <CR><LF> (Windows) where my updated file ended with only <CR> (Linux). Preference? Mine is currently set for Linux as that is what some other projects wanted...
Spacing - Tabs versus spaces? How much to indent. I know lots of us have different preferences. Personally I prefer indenting by 4... I know others like by 2... I know some of the current files are done with spaces others with tabs...
Code blocks - Where to put the brackets?
if () {
}
if ()
{
}
if ()
{
}
Personally I can go anyway. My least favorite is the third one, and over the years I have alternated between the first two depending on the project.
Where things start to get tricky are with things like naming conventions. Which is probably something for follow on discussions.
Thoughts?
Kurt
One standard I know some are semi following now is that for ROS: http://wiki.ros.org/CppStyleGuide
Which might be nice to get to, but it might take a bit to get there.
In the mean time, there are some simple things we might want to think about, like:
End of lines - My last edit of a few of the files showed up like I changed every line. Turns out the file was previously saved with every line ending in <CR><LF> (Windows) where my updated file ended with only <CR> (Linux). Preference? Mine is currently set for Linux as that is what some other projects wanted...
Spacing - Tabs versus spaces? How much to indent. I know lots of us have different preferences. Personally I prefer indenting by 4... I know others like by 2... I know some of the current files are done with spaces others with tabs...
Code blocks - Where to put the brackets?
if () {
}
if ()
{
}
if ()
{
}
Personally I can go anyway. My least favorite is the third one, and over the years I have alternated between the first two depending on the project.
Where things start to get tricky are with things like naming conventions. Which is probably something for follow on discussions.
Thoughts?
Kurt