Open theZiz opened 7 years ago
eaasy :)
no code alignment (only indention)
no, >1 argument have all one line per argument
code inside the deepest namespace is indented
yes it is! often seen in traits
and details
scopes. but actually: the first level of non-namespace objects in indented from its namespace if that is still up to date @psychocoderHPC .
namespace foo
{
namespace traits
{
template<
typename T_Type
>
struct Bar;
} // namesspace traits
void a();
template<
typename T_Type
>
void bar( T_Type t )
{
traits::Bar::bar( t );
}
} // namespace foo
Template Class / Struct and Type Definitions
should be template< ...
as with any opening bracket that belongs to it's opening "object".
Hijacking this old issue: I am currently working on a proposal to overhaul these coding guidelines. I see that we are referencing C++98 in some cases - do we still need to consider this quite ancient standard? Or can I remove those lines? @psychocoderHPC
Thank you for proposing an overhaul!
IMO i would throw all the coding guidelines away that can be automated by clang-format. Then add a clang-format file and maybe annotate some of the options why they have been chosen this way.
I think the suggestion of @bernhardmgruber is great, as that would keep everything at a single place (clang-format file), and so only one place needs to be updated/extended
clang-format is done but we will need clang-tidy as well to enforce all of our standards. Working on that now. I will upload both .clang-format
and .clang-tidy
once I'm done.
Hijacking this old issue: I am currently working on a proposal to overhaul these coding guidelines. I see that we are referencing C++98 in some cases - do we still need to consider this quite ancient standard? Or can I remove those lines? @psychocoderHPC
No C++98 is IMO not ised anymore. We can focus on C++14 and newer.
I agree, C++14 should be the minimal standard.
I have some questions and unclearities about the coding guidlines.
no code alignment (only indention) What does this mean? No code like this
but this
?
@ax3l:
code inside the deepest namespace is indented This is missleading. What if I have such a code:
It fulfills the rule, but is this really the intended behaviour?
Template Class / Struct and Type Definitions There is no explicit rule, that the opening tocken of a template parameter needs to be bing to the
template
keyword, such that this is forbidden:although it makes sense in the general context. However especially with these defintions over more than one line, it it harder to spot
template<
thantemplate <
. The same is in fact also true for function and method definitions, but(
is slimer and therefore better to spot, so the effect is not so strong. Is it really that important to forbid these spaces?