Giter Club home page Giter Club logo

Comments (11)

cnpetra avatar cnpetra commented on July 28, 2024

agree. I think I've changed the coding style at least one time as I worked on different project over the years :). do you have a coding style document/link?

from hiop.

ashermancinelli avatar ashermancinelli commented on July 28, 2024

It would be my preference to use this style guideline. Would you two mind taking a look? We could add clang-tidy scripts to help us all write conformant code if that sounds good to you both.

from hiop.

pelesh avatar pelesh commented on July 28, 2024

I agree with @ashermancinelli, the guidelines he referenced are becoming a gold standard pretty much. The relevant chapter for this discussion is I think in Naming and Layout Rules chapter.

The only amend I would make is to use Allman style, rather than K&R, simply because it leads to a code that is easier to read in a large editor window.

In the end it is all very much a matter of personal taste. The most important thing is that we are all consistent.

@cnpetra in the short term, it would be very helpful if you could set rules for distinguishing member from local variables.

from hiop.

ashermancinelli avatar ashermancinelli commented on July 28, 2024

I too prefer Allman style 😄 we could add some scripts for formatting errors when in HIOP_DEVELOPER_MODE to extend what Cosmin and I discussed in #22 . clang-tidy has a options to enable cppcoreguildeline warnings by default, and I have it installed on marianas and newell.

from hiop.

cnpetra avatar cnpetra commented on July 28, 2024

cppcoreguildeline seems to be not very specific but it would be of value if we can enable code style warning/checking in DEVEL_MODE.

I am taking a shot below, please feel free to comment and suggest specific additional guidelines

indentation

  • my personal preference is for compact K&R (no separation of between "if" and "("), similar to C, but I am willing to switch to Allman (as long it can be enforced via clang-tidy or similar tool)
  • two spaces alignment, maybe four if you like it better, but do not use tabs

naming

  • classes: Upper and lower case, no underscores
  • data members: ending in _; lower case only and use _ to separate
  • member methods: lower case only and use _ to separate

to be continued...

from hiop.

cnpetra avatar cnpetra commented on July 28, 2024

it wouldn't hurt to look at M-FEM dev-guidelines. Consistent code styling enforced via make style and based on Artistic Style.

from hiop.

pelesh avatar pelesh commented on July 28, 2024

@cnpetra what you suggest sounds reasonable. As I said, the most important thing is that we are consistent.

A couple of more references that might be helpful:

  • The most detailed guidelines that I've seen are published by Stroustrup for JSF program. These are a bit old and may not address recent C++ features. This seems to be a precursor to cppcoreguidelines.
  • From ECP family, there are NOX/Trilinos style guidelines that might be relevant for HiOp.

from hiop.

ashermancinelli avatar ashermancinelli commented on July 28, 2024

What naming convention for feature branches would be preferred? For example, always branch from master and name the branch <feature or fix>-dev

from hiop.

cnpetra avatar cnpetra commented on July 28, 2024

feature-developmentname or fix-bugname would do I guess. I use dev/devname and fix/fixname, but not for particular reason.

always branch from master, indeed, and master serves as stable for now.

from hiop.

ashermancinelli avatar ashermancinelli commented on July 28, 2024

I will change the PR accordingly. I prefer -s over /s so not to confuse ref pathnames and remotes with branch names.

from hiop.

cnpetra avatar cnpetra commented on July 28, 2024

closing this -- the discussion moved to the PR and we're in some kind of (initial) agreement

from hiop.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.