compdyn / partmc

Particle-resolved stochastic atmospheric aerosol model
http://lagrange.mechse.illinois.edu/partmc/
GNU General Public License v2.0
27 stars 15 forks source link

Use clang-format for c code? #109

Closed mattldawson closed 4 years ago

mattldawson commented 4 years ago

If we use clang-format for the .c and .h files it might make it easier to maintain consistency in coding style.

mattldawson commented 4 years ago

@mattldawson 's style for c code has drifted over time and @cguzman95 has his own style. We could consider using clang format and some automation for the c code to keep it a little cleaner.

I would propose that we only do this at a point where there are no open develop branches. It may make the subsequent merge harder. And, that we only apply it to the CAMP c files, not the ones in the PartMC master branch (for the same reason).

As we wait for a time when we could implement this, we could discuss what style everybody likes.

What do you guys think?

mwest1066 commented 4 years ago

đź‘Ť

Code formatters are great! Huge reduction in thought and friction.

mattldawson commented 4 years ago

Awesome! Are there any of these available for Fortan code? I'm not aware of any.

mattldawson commented 4 years ago

(side note - it's kind of fun talking in 3rd-hashtag)

mattldawson commented 4 years ago

Seems like there are some default styles we could use:

LLVM A style complying with the LLVM coding standards Google A style complying with Google’s C++ style guide Chromium A style complying with Chromium’s style guide Mozilla A style complying with Mozilla’s style guide WebKit A style complying with WebKit’s style guide Microsoft A style complying with Microsoft’s style guide

I have no preference, and I can't think of anything special I really care about one way or another. What do you guys think? We also have the option of starting with one of these styles and modifying it, if there's something we would like to change.

cguzman95 commented 4 years ago

Doing a fast review, I like the Google C++ style. At least the documentation is very clear and remarks the pros and cons. When there are no open development branches and we solve the major issues, we can analyze this deeply

mattldawson commented 4 years ago

Talking with @cguzman95 we decided to go ahead and try this now (with the Google style). It might actually make the merges easier because we can format the chem_mod and develop- branches before merging.

mattldawson commented 4 years ago

ok, I think this might be working now:

cguzman95 commented 4 years ago

Okay I will check that format in the next issues