Why does ROS c++ codestyle wiki contradict google c++ codestyle
While looking for the standard C++ codestyle, I ended up at the wiki: http://wiki.ros.org/CppStyleGuide It is based on the google cpp style guide, since "..it is a well-written document on the topic at hand..". Nothing wrong with that I think.
While reading the ROS wiki, I noticed that curly brace codestyle is to have the culry brace on a line of its own (in Section 6). The google c++ code style does not do that however, it places the open curly brace always at the end of the line. The ROS wiki does not give any explanation whatsoever on why this was chosen.
Example:
ROS wiki:
if(a < b) { // do stuff } else { // do other stuff }
google style guide:
if (condition) { // no spaces inside parentheses ... // 2 space indent. } else if (...) { // The else goes on the same line as the closing brace. ... } else { ... }
In other words, ROS cppstyle wiki uses a "well-written document on the topic on hand" as guide for the code style, and then simply discards that wisdom with some other code style, without any explanation as to why.
Can someone please enlighten me why google code style is not followed here?
Can you please post a code example of what you're talking about?
@jayess this is a general question, so not related to particular code. ROS wiki states "Braces on seperate lines", Google uses opening braces on same line.
@mig I understand, but sometimes it's useful to have examples