ddc icon indicating copy to clipboard operation
ddc copied to clipboard

Cleanup inline, constexpr & noexcept

Open tpadioleau opened this issue 3 years ago • 5 comments

We currently apply the constexpr, inline & noexcept modifiers to functions somewhat randomly. This should be reviewed. We should come up with some guidelines and apply them all-around.

tpadioleau avatar Mar 23 '22 08:03 tpadioleau

See also https://gitlab.maisondelasimulation.fr/gysela-developpers/voicexx/-/issues/68

jbigot avatar Mar 28 '22 05:03 jbigot

Concerning constexpr:

  • DiscreteElement
  • DiscreteVector
  • DiscreteDomain
  • ChunkSpan

should be constexpr compatible. Not clear if it useful though.

Concerning inline, because for now DDC is a header-only library, inline is only used to make sure we do not violate the ODR.

Concerning noexcept, I try to follow a general good practice rule so that move constructors, assignment operators and destructors are noexcept.

tpadioleau avatar Mar 26 '24 11:03 tpadioleau

inline is also useful to increase the inlining probability of a function as its name hints

jbigot avatar Mar 28 '24 08:03 jbigot

noexcept should usually be conditional in templates

jbigot avatar Mar 28 '24 08:03 jbigot

inline is also useful to increase the inlining probability of a function as its name hints

Not clear to me when one actually wants just an increase of the inlining probability. I usually end up in situations where I explicitly want inlining or I do not care about it.

tpadioleau avatar Mar 28 '24 17:03 tpadioleau