-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC: Standardize curly bracket style #24
Comments
I am not up to speed on C++ standards, but I will say that at SMM we've tried to defer to other people's code style guides rather than develop our own. I'd suggest we pick and existing standard and if we feel very strongly that we need to make an exception, we can document our deviation from that style. For JS we use Airbnb's because they're the leader in that space. My quick search seems to suggest that Google's standards are the leader in the C++ space. Here is their guidance on function declarations, which I think is what you're discussing here on curly braces. |
And this tool (cpplint), looks like it would make it very easy to automatically lint our code based on that style guide. |
Thanks for creating a space for this dialog @sanine-a and weighing in. I had similar observations to @twsdbailey , that most arduino libraries I've seen are same line. Same line is how I was writing prior to using the defaults of a VS Code linter. Looking at @bryankennedy links it seems that is also what Google is doing.I think we should move forward with the Same Line example. I'll dig into cpplint |
Fwiw, @eojreyem and I have linters built into our editors (vscode) to handle linting. When this issue first came up, @eojreyem discovered we could change our |
This came up in our discussion of #23, and I think we should try to standardize. Do we want to use brackets on separate lines?
Or do we want to use brackets on the same line?
My preference is the first one, because I think it helps to visually distinguish function declarations from code blocks and aid somewhat in code navigation, and it also can make certain types of formatting a bit nicer. For instance, if a function has many arguments, it can help to break those arguments up over multiple lines, and I think that looks kind of strange if the brackets are on the same line as the parentheses. However, it's only a preference and if others feel very strongly about using brackets on the same line I'd be fine with that.
The text was updated successfully, but these errors were encountered: