-
Notifications
You must be signed in to change notification settings - Fork 217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CodingGuideLines: Add Link to Wiki #140
CodingGuideLines: Add Link to Wiki #140
Conversation
|
thanks! |
After a short talk: I personally prefer sticking the |
Should we use one more line to define functions, because the return type of a function can be very complex e.g. template<class T_A> /* templates */
HDINLINE /* compiler hints */
typename boost::result_of< typename OtherClass<T_A>::type >::type /*result type of function*/
functionName( ... ) /* name params */
{
/* ... */
} |
We should also add a point about the conventions |
To the Point with 2 or 4 spaces: I think we should switch to 2 spaces because of the strong template usage we had very long lines. |
... and due to a whole bunch of namespaces and sub-classes and stuff. |
We should add the rule that we not indent inside of namespaces namespace Bob
{
struct Foo;
}
//wrong style
namespace Alice
{
Struct FooWrong;
} |
I propose to use uncrustify as a pre-commit hook to ensure coding guidelines. |
@psychocoderHPC namespaces: I would prefer intenting namespaces (if standard spacing is 2 spaces). Anyway, if not I would prefer to start intending with the first non-namespace object like this: namespace Bob
{
/* no spaces */
namespace Alice
{
/* this guy gets intended */
Struct FooMe;
} // namespace Alice
} // namespace Bob |
k, so no spaces for opening a new namespace. but every level inside them. added to wiki. |
Maybe the only exception for this rule? namespace Bob /* "general" outer namespace */
{
namespace Alice /* "general" outer namespace */
{
/* this guy gets intended */
Struct FooMe;
/* some brainy likes to create a long mixed file
* -> indent to avoid mixing it with the general outer namespaces */
namespace SI
{
/* you should avoid that, ok in config files like .param ? */
} // namespace SI
/* this guy gets intended */
Struct FooMeAgain;
} // namespace Alice
} // namespace Bob But we could also skip that and stay as it is defined in the first place. Just looks a bit crude. |
looks good to me 👍 int var = 12.0; // the meaning of life |
for precompiler commands we should also use a nice style like this: #if(VARIABLE_BOB==1)
# if(VARIABLE_ALICE==1)
# define HPC +1
# endif
#endif |
👍 boost does the same, I like that, too. Related to #143 : we should check if the file contains a recent copyright notice (if possible) and on a directory-basis if the right license header was added. |
Because that causes hard to track nvcc compile errors in cases like this: void function( int a, // my first parameter
int b
)
{
/* ... */
} Nvcc comments out the follow-up line(s) |
@ComputationalRadiationPhysics/picongpu-maintainers I really had to try that feature. |
Can we use no white spaces between compare operators? Than we have a stronger binding of compare and other operators. if ( test == 1 && test2 == true )
{
y = y + -1;
} vs no spaces if ( test==1 && test2==true )
{
y = y + -1;
} |
behold, I let's use parantheses instead!
|
I think this is not possible with uncrustify. |
I think using spaces is just fine. |
Do we need a limitation of 80 character per line? At the moment we wrap all long lines in #161. Is someone developing our code on such a small console? We use often very long names for classes and have a lot of typedefs and templates this effects line breaks and unreadable code on many parts of the code. |
80 characters would be nice, since we actually do 3-way-merges. But I would just ignore that for now (no warning). |
I have tested 100 and 120, both looks good for me, more than 120 is to much. |
ok, so let us try maybe 100 for now? |
👍 for 100 character per line. |
👍 100 characters |
Reordered the wiki page: grouped the rules in 5 useful sections for better orientation. |
@ComputationalRadiationPhysics/picongpu-maintainers Any more comments? Else I would just say we can merge that for now and discuss minor updates in |
Also zu MEINER Zeit haben wir nur 40 Zeichen gebraucht.
|
Your braille display did not support more output anyway label if (logical something) then
some statements
goto label
endif Edit: just realized that comment is in arbitrary levels inappropriate. |
A IBM punch card has 80 columns http://en.m.wikipedia.org/wiki/Punched_card |
100 cols is fine, more is not. otherwise a kdiff3 merge is scrolling hell! |
I am not sure if certain agencies can properly parse this and use our comments against us if not written in ASCII English |
👍 for sarcAnot, v1.0. Btt:
|
I'm fine with the current state, no remarks so far. |
CodingGuideLines: Add Link to Wiki
977b55f Merge pull request ComputationalRadiationPhysics#141 from ax3l/doc-usagelink 0f79cd5 Link Usage.md 8415cb1 Merge pull request ComputationalRadiationPhysics#140 from psychocoderHPC/topic-makeAllocatorSelfConstistent ee6f58e update examples 8822cb0 remove `finalizeHeap()` from `creationPolicies` ebb37f5 update `Usage.md` 66785ac selfe consistent allocator a036d5c Merge pull request ComputationalRadiationPhysics#135 from psychocoderHPC/fix-missingPoolSizeReset 449bc7b Merge pull request ComputationalRadiationPhysics#136 from psychocoderHPC/topic-destructiveResize b2e0d76 add `destructiveResize` method d0ecb62 fix missing local size change in `finalizeHeap()` 9c58f4d Merge pull request ComputationalRadiationPhysics#133 from psychocoderHPC/fix-ptxSpecialRegisterUsage 4cd47f0 fix missing '%%' to use ptx special register cee846f Merge pull request ComputationalRadiationPhysics#127 from slizzered/documentation-add-thesis b92f67f Merge pull request ComputationalRadiationPhysics#128 from slizzered/travis-fix_Werror 53e86b4 simpler handling of CXX_FLAGS d2c4e08 Merge pull request ComputationalRadiationPhysics#126 from slizzered/fix_115 85143c0 Updated Readme.md 5f84db9 fixed string concatenation eb1ad2d Fix to travis file: -Werror ad72a61 Check heap pointer in Scatter creation policy ffa4f7e Merge pull request ComputationalRadiationPhysics#125 from ComputationalRadiationPhysics/slizzered-patch-1 368478c moar fixes a0bd2eb Update Usage.md 69a6973 Merge pull request ComputationalRadiationPhysics#109 from Flamefire/staticConstexpr 638fa5b Use BOOST_STATIC_CONSTEXPR c0c6450 Merge pull request ComputationalRadiationPhysics#116 from slizzered/issue113-separate_object_host_device 4070f40 some renamig and freeing at end of examples b9fe440 added implicit conversion to device handle 7f742b8 fixed OldMalloc policy to comply with new interface 0de5416 removed unnecessary inheritance 28c52c2 fixed a return type to comply with defined interface 503f0bd changed pointer to handle d281cbe replaced initHeap function with constructor 74ba8aa Replaced the global __device__ object 4fa2d75 Merge pull request ComputationalRadiationPhysics#121 from ax3l/fix-cincludes d99a6f3 Fix: Includes from C headers b52c2b2 Merge pull request ComputationalRadiationPhysics#119 from ax3l/fix-travis eb096f7 Updating to Travis-CI Trusty Beta 93ab74b Merge pull request ComputationalRadiationPhysics#112 from slizzered/issue110-error-handling 90881fd Fixed problems leading to uninitialized pointers 8980ead Merge pull request ComputationalRadiationPhysics#108 from Flamefire/exampleC++11 a92d4e1 Rename some shadowed variables in C++11 mode git-subtree-dir: thirdParty/mallocMC git-subtree-split: 977b55f98fe0e6e4545f6e092660b7b4f1b54493
0594a68a0 Merge pull request ComputationalRadiationPhysics#140 from psychocoderHPC/topic-cuplaTargetBehavior 0991f2c6e compile cupla interfaces into static cupla library 914a87133 Merge pull request ComputationalRadiationPhysics#136 from psychocoderHPC/topic-refactorKernelExecution 0027076c7 Merge pull request ComputationalRadiationPhysics#137 from psychocoderHPC/topic-supportForAlpakaOMP4Backend d2b118662 Merge pull request ComputationalRadiationPhysics#139 from psychocoderHPC/fix-configHeader 16c084970 support for alpaka OMP4 backend e990d63c5 fix config header e2048f565 refactor cupla kernel execution d5f969a93 Merge pull request ComputationalRadiationPhysics#132 from sbastrakov/doc-clarifyIncludeOrder cca400a60 Clarify documentation of inclusion order 4578ae151 Merge pull request ComputationalRadiationPhysics#128 from psychocoderHPC/topic-updateAlpakaToCurrent0.4.0dev 0c090e536 Merge commit 'dd8afa5cec90a1398b8da3f9cd7d30aa59664cb5' into topic-updateAlpakaToCurrent0.4.0dev dd8afa5ce Squashed 'alpaka/' changes from 0a2b6161..d5e59590 767768a88 rename alpaka queue names 8c227fbb6 Merge pull request ComputationalRadiationPhysics#130 from psychocoderHPC/fix-configHeaderTest a6c3da536 fix `config header` test a439c9d6b Merge pull request ComputationalRadiationPhysics#129 from psychocoderHPC/topic-updateTravisCMakeTo3.15.4 2e0daaf1b update tavis CMake to 3.15.4 04698e9c6 Merge pull request ComputationalRadiationPhysics#123 from SimeonEhrig/ci_enable_backends 25e64b623 time command add to ci test c559bf432 Merge pull request ComputationalRadiationPhysics#107 from SimeonEhrig/init-gitlab-ci 488a2e95f Merge pull request ComputationalRadiationPhysics#117 from tdd11235813/pr-fixes-atomics c2916be68 Adds atomicAnd, atomicXor, atomicOr. 7c330a5a9 Merge pull request ComputationalRadiationPhysics#112 from psychocoderHPC/topic-standaloneHeader d84f2fdea configuration header 6a97c1cf1 Merge pull request ComputationalRadiationPhysics#113 from fwyzard/dev_cuplaGetErrorName d210a37a0 Add cuplaGetErrorName with the same functionality as cuplaGetErrorString d050bf3cd Merge pull request ComputationalRadiationPhysics#111 from tdd11235813/doc-subtree 19cf46913 Describes how to pull subtree as generic git author. 4ecc143f4 Merge pull request ComputationalRadiationPhysics#103 from tdd11235813/dev 16c806e68 Merge pull request ComputationalRadiationPhysics#104 from tdd11235813/dev-targets 43fd52319 Add gitlab-ci.yml for GitLab CI tests fd37e7b7d Alpaka as git subtree instead of git submodule. 16b455107 Squashed 'alpaka/' content from commit 0a2b6161 69b79bd95 Merge commit '16b4551075f93cdd71309433b02936a152dfee9f' as 'alpaka' fa5cc5260 Removes alpaka git module. 67485d510 Some stylistic changes. 4f2b9c019 CUPLA_ADD_EXECUTABLE links cupla target. Target provides c++11. git-subtree-dir: thirdParty/cupla git-subtree-split: 0594a68a0d9bdbfc949391f83473d4734575a7f5
@f-schmitt-zih @Heikman @ahelm @psychocoderHPC @PrometheusPi Please add your comments about the current draft in this pull request!