Rough proposal based on the most common style in the existing code base:
// CamelCase (w/ upper case initial) for all custom types, including typedefs for fundamental types// No `..._t` or `..._type` hereclassComplicatedNamedClass;structAnotherStruct;enumEnumType;usingSemanticName=int32;// Avoid abbreviations; if still used, only use upper case for the first letter sincet the// abbreviation is semantically a single word, e.g. VertexSomething could bestructVtxSomething;// not VTXSomething.// This is bad example since the name should not be abbreviated here anyways.// snake_case_t for template parameter types// To clarify that these are dynamic types and to avoid naming collisions// when reexporting the typetemplate<typenamelarge_vector_t>structAlgorithm{// make the template type publicly availableusingLargeVector=large_vector_t;...};// CamelCase (w/ upper case initial) for namespacesnamespaceSomething{...}// The only exception is the `detail` namespace within another one.// `detail` must never be the top-most namespacenamespaceFoo{namespacedetail{...}}// mixedCase (w/ lower case initial) for functions and methodsdoSomething(...);thing.doSomething(...);// same conventions for implementation details// there are quite a few cases where details helpers use snake_case instead. these functions// are not fundamentally different from regular functions and are already marked as special// by virtue of being in the `detail` namespace.detail::anImplementationDetail(...);// mixedCase (with appropriate prefixes) for variablesintaVariable;structThing{doubleaPublicVariable;floatanotherPublicOne;};classFoo{private:m_privateMember;};// Both for globals (eeww) and static class/struct membersstaticints_doesNotChange=-42;// CamelCase with k prefix for constants// Constants must always be `constexpr`staticconstexprdoublekMagic=1.23;// Exception: unit definitions in the `Acts::UnitConstants` namespace// CamelCase with e prefix for enum values// These are not really constants but symbolic values, e.g. they can never have an address.enumBar{eBla,eBlub,};// enums should be `enum class` unless they can not be.// ALL_UPPER_CASE with ACTS_ prefix for macrosACTS_NEVER_USE_MACROS(...)
I have another suggestion: every separate part of a class/function declaration/definition should be in a separate line, including each argument, like this:
I mostly agree, but that is a formatting issue that should be handled automatically by clang-format. This is not a naming issue. I think, there is a pending MR !626.
Regarding the SurfacePtrVector discussion: I think we should not have these typedefs to begin with, e.g. if I see SurfacePtrVector it is not immediately clear if this means
This can of course be clarified by using a more presciptive name, e.g.
using SurfaceConstSharedPtrContainer = std::vector<std::shared_ptr<const Surface>>;
at which point the typedef is about as along as the original type. My preference would be to get rid of these typedefs altogether and just use e.g. std::vector<std::shared_ptr<const Surface>> directly in a global context. In a local context, it might still be useful to provide typedefs to simplify our code, but in that case the name should be semantical and not merely descriptive, e.g.
struct SurfaceAlgorithm { using InputSurfaces = std::vector<std::shared_ptr<const Surface>>; ...};
Regardless, this is more of a general code style issue and not merely naming.
In the new test version of the geometry without layers, I actually managed to go around the constness problem we have in the geometry building ... but that's a discussion for another day.