Hi, after playing with clang-format a bit, it seems that our current coding style is now _mostly_ compatible. There are to (minor) exceptions:
1. Always break function parameters
There is not configure options to always break function parameters, e.g.
f (x,
y,
z);
Parameters are either all in one line
f(x,y,z)
if it fits or all are in their own line
f(x,
y,
z)
Currently, in the code we have a subjective choice on when to do that.
2. Odd formatting with yoda style conditionals:
Example with yoda:
GNUNET_assert (
GNUNET_YES ==
GNUNET_CONTAINER_multipeermap_remove (dv_routes, &dv->target, dv));
without:
GNUNET_assert (GNUNET_CONTAINER_multipeermap_remove (dv_routes,
&dv->target,
dv) == GNUNET_YES);
Given that modern compilers (e.g. also GCC) give a warning (with -Wall) when
you put an assignment in a condition statement, maybe we don't need to put this
in the style anymore?
Readability would be the primary benefit, correct formatting secondary.
Opinions?
> On 16. Apr 2019, at 11:32, Schanzenbach, Martin <[email protected]>
> wrote:
>
> Signed PGP part
> Updated the format file with all your propsals. Now needs a clang-format
> which at least includes this commit:
> https://github.com/llvm-mirror/clang/commit/c4515d09740be87226d185f7728893d26c5af652
>
> i.e. > clang 8.0.0; let's hope they release soon (tm)
>
>> On 16. Apr 2019, at 11:17, Schanzenbach, Martin <[email protected]>
>> wrote:
>>
>> Signed PGP part
>>
>>
>>> On 16. Apr 2019, at 10:54, Christian Grothoff <[email protected]> wrote:
>>>
>>> Signed PGP part
>>> On 4/16/19 10:48 AM, Schanzenbach, Martin wrote:
>>>> I added your changes with two notes:
>>>>
>>>> 1. SpaceAfterLogicalNot: true => This option does not seems to exist
>>>> (anymore?)
>>>
>>> That's a pity. I think this is a nice way to emphasize the not.
>>
>> I checked. It has been added recently. You need clang-format > 8.0.0 (i.e.
>> currently git HEAD)
>>
>>>
>>>> 2. AllowAllParametersOfDeclarationOnNextLine: false # CG: documentation
>>>> has AllowAllArgumentsOfDeclarationsOnNextLine! => I don't know what you
>>>> mean by this.
>>>
>>> It means that the Web manual I was reading had an option with
>>> "Arguments" in the name, while your file had "Parameters", so I don't
>>> know what it should be, or whether the docs I'm reading matched what the
>>> option does.
>>
>> Ah. Probably a typo in the docs.
>>
>>>
>>>
>>>
>>
>>
>>
>
>
>
signature.asc
Description: Message signed with OpenPGP
_______________________________________________ GNUnet-developers mailing list [email protected] https://lists.gnu.org/mailman/listinfo/gnunet-developers
