Skip to content
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

Code Style #12

Open
paulftw opened this issue Nov 10, 2014 · 2 comments
Open

Code Style #12

paulftw opened this issue Nov 10, 2014 · 2 comments

Comments

@paulftw
Copy link
Owner

paulftw commented Nov 10, 2014

When I started the project in 2004(ish) I didn't know much about coding styles. Decision I regret the most is using tabs (because it's 2014 and nobody else seems to be using tabs for formatting).

We should a) choose a C++ Style Guide for all future code; b) convert existing files to this style.

I think Boost style guide would be a natural fit, since whole library is mimicking Boost Serialization where possible.

Any ideas or suggestions on this?

@d-led
Copy link
Collaborator

d-led commented Nov 12, 2014

In my view, it would make sense if it's automatic and possibly a pre-commit hook. I've been thinking about using Astyle or better ClangFormat, as it is based on a real compiler, but then gave up the idea for my projects.

There are many things to a style guide, and the discussions about those are always hot. I'd rather recommend writing down "C++ usage best practices in hiberlite", as these are more dangerous than whitespaces, and can be best checked using code reviews. Google C++ Style Guide is an example of such an approach, and is a living document too. There are, of course, automatic checkers of C++ usage too: Clang Static Analyzer, cppcheck, cpplint.py, etc

@paulftw
Copy link
Owner Author

paulftw commented Nov 13, 2014

I know style guides are a subject of numerous flame wars. Choosing the best one is not my goal.
Two reasons for wanting an automated formatting tool are:

  1. get rid of the tabs
  2. have consistency and guideline for future contributions

There's little to no value in trying to decide on what is the best style guide is, or inventing a bespoke style guide for hiberlite.
It has to be good enough and simple to police, thus my interest in an off the shelf formatting tool.
Something that'd be quick and easy to install. I'd go with either Astyle or ClangFormat.

An argument against Google guide is that they are building end products, whereas hiberlite is more like a "standard" library (not really standard but really wants to become one when it grows up). So I'd like user facing API to follow same style as STL and Boost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants