www.libssh2.org | Daily snapshots | Mailing list archive | Docs | Examples | github

Archive Index This month's Index

Subject: Re: Code style and project status

Re: Code style and project status

From: Andreas Schneider <asn_at_cryptomilk.org>
Date: Thu, 21 Mar 2019 15:40:02 +0100

On Wednesday, March 20, 2019 11:17:26 PM CET Daniel Stenberg wrote:
> On Wed, 20 Mar 2019, Will Cosgrove wrote:
> > Any chance we can extend the line length over 80 characters? Is there a
> > reason to use this antiquated value?
>
> Some call it antiquated. I call it sensible.

It isn't antiquated at all, there is an important reason for this. This forces
you to write cleaner code. If you start writing loops and if clause and you
exceed 80 columns it is and indicator that you should create a new functions.
For that reason the Samba project and the Kernel use 8 char tab stop.
Personally I prefef 4 spaces but that's another discussion.

The other reason is that a lot of people work with split windows :-)

Also you should use one argument per line like:

void my_very_long_function_name_with_dashes(struct my_super_duper_s arg1,
                                            struct my_super_duper_s arg2,
                                          bool x);

What is the benefit of writing it like that or calling it like:

my_very_long_function_name_with_dashes(arg1,
                                       arg2,
                                       x);

If you later change the name of one argument, or add a new one the diff will
be smaller and easier to review :-)

Lessens learned in a project older than the Linux Kernel ;-)

Just my 2 cents.

        Andreas

-- 
Andreas Schneider                 asn_at_cryptomilk.org
GPG-ID:     8DFF53E18F2ABC8D8F3C92237EE0FC4DCC014E3D
_______________________________________________
libssh2-devel https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2019-03-21

the libssh2 team