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

clang-format #19

Open
risc26z opened this issue Feb 4, 2024 · 1 comment
Open

clang-format #19

risc26z opened this issue Feb 4, 2024 · 1 comment

Comments

@risc26z
Copy link

risc26z commented Feb 4, 2024

Please could we adopt clang-format in the project? If you're unfamiliar with it, it automatically applies some code formatting rules, specified in a file named '.clang-format' in the project root. Lots of editors have built-in support. I'm attaching a rules file that I use in one of my own projects as an example (it'll need to be renamed).

Readability helps a lot with working on a large codebase, and consistency in formatting really makes a difference. I have a little shell script with a 'find' recipe to run it against all my source files (I also invoke dos2unix at the same time).

Advantages:

  • Consistency and improved readability of the source tree,
  • It's easy for people who dislike the project's .clang-format to substitute their own, reformat, edit, debug, etc, then reformat to the project style before committing the changes. It's a real headache otherwise, especially when you've already used it to make browsing through the code easier.

Disadvantages:

  • There is a single, large diff when formatting is applied the first time.

clang-format.txt

@wrcad
Copy link
Owner

wrcad commented Feb 19, 2024

Thank you, I'll look into this when I get time.

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