diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-05-20 12:11:05 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-05-20 12:11:05 +0200 |
commit | 51194a29d0ca1284ae84e83eab92ac2a0e1f675a (patch) | |
tree | a2c8d60b06f3df06491ec8d65865b69383fce3b1 /doc/handbook | |
parent | 09f221a8156196769e6ab0e40094ca715316e543 (diff) | |
download | gnunet-51194a29d0ca1284ae84e83eab92ac2a0e1f675a.tar.gz gnunet-51194a29d0ca1284ae84e83eab92ac2a0e1f675a.zip |
style specing
Diffstat (limited to 'doc/handbook')
-rw-r--r-- | doc/handbook/chapters/developer.texi | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/doc/handbook/chapters/developer.texi b/doc/handbook/chapters/developer.texi index de5166226..ca76a5f2b 100644 --- a/doc/handbook/chapters/developer.texi +++ b/doc/handbook/chapters/developer.texi | |||
@@ -848,8 +848,9 @@ libgnunet_plugin_transport_tcp) | |||
848 | @c XXX: Adjust examples to GNU Standards! | 848 | @c XXX: Adjust examples to GNU Standards! |
849 | @itemize @bullet | 849 | @itemize @bullet |
850 | @item We follow the GNU Coding Standards (@pxref{Top, The GNU Coding Standards,, standards, The GNU Coding Standards}); | 850 | @item We follow the GNU Coding Standards (@pxref{Top, The GNU Coding Standards,, standards, The GNU Coding Standards}); |
851 | @item Indentation is done with spaces, two per level, no tabs; | 851 | @item Indentation is done with spaces, two per level, no tabs; specific (incomplete!) indentation rules are provided in an @code{uncrustify} configuration file (in ``contrib/``) and enforced by Git hooks; |
852 | @item C99 struct initialization is fine; | 852 | @item C99 struct initialization is fine and generally encouraged (but not required); |
853 | @item As in all good C code, we care about symbol space pollution and thus use @code{static} to limit the scope where possible, even in the compilation unit that contains @code{main}; | ||
853 | @item declare only one variable per line, for example: | 854 | @item declare only one variable per line, for example: |
854 | 855 | ||
855 | @noindent | 856 | @noindent |
@@ -1063,6 +1064,32 @@ separated by an empty line (possibly followed by a comment describing the | |||
1063 | following step). The code should not contain empty lines in arbitrary | 1064 | following step). The code should not contain empty lines in arbitrary |
1064 | places; if in doubt, it is likely better to NOT have an empty line (this | 1065 | places; if in doubt, it is likely better to NOT have an empty line (this |
1065 | way, more code will fit on the screen). | 1066 | way, more code will fit on the screen). |
1067 | |||
1068 | |||
1069 | @item When command-line arguments become too long (and would result in | ||
1070 | some particularly ugly @code{uncrustify} wrapping), we start all arguments | ||
1071 | on a new line. As a result, there must never be a new line within an | ||
1072 | argument declaration (i.e. between @code{struct} and the struct's name) or | ||
1073 | between the type and the variable). Example: | ||
1074 | |||
1075 | @example | ||
1076 | struct GNUNET_TRANSPORT_CommunicatorHandle * | ||
1077 | GNUNET_TRANSPORT_communicator_connect ( | ||
1078 | const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
1079 | const char *config_section_name, | ||
1080 | const char *addr_prefix, | ||
1081 | ...); | ||
1082 | @end example | ||
1083 | |||
1084 | Note that for short function names and arguments, the first argument | ||
1085 | does remain on the same line. Example: | ||
1086 | |||
1087 | @example | ||
1088 | void | ||
1089 | fun (short i, | ||
1090 | short j); | ||
1091 | @end example | ||
1092 | |||
1066 | @end itemize | 1093 | @end itemize |
1067 | 1094 | ||
1068 | @c *********************************************************************** | 1095 | @c *********************************************************************** |
@@ -8941,4 +8968,3 @@ view are sampled through the sampler from the random stream of peer IDs. | |||
8941 | 8968 | ||
8942 | According to the theoretical analysis of Bortnikov et al. this suffices | 8969 | According to the theoretical analysis of Bortnikov et al. this suffices |
8943 | to keep the network connected and having random peers in the view. | 8970 | to keep the network connected and having random peers in the view. |
8944 | |||