wget-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Wget-dev] wget2 | WIP: Use GNU Indent (!370)


From: Tim Rühsen
Subject: Re: [Wget-dev] wget2 | WIP: Use GNU Indent (!370)
Date: Wed, 08 May 2019 14:38:33 +0000



Ok, starting with the basics:
- tabs for indentation, spaces for alignment
- line length max. 120 chars (exceptions for readability)
- Unix style linebreaks (just linefeed '\n')
- tab width recommendation: 3 or 4
- single line comments start with //

More rules are tedious to write down, at least nothing that I would like to do.

For contributors we can just formulate a basic set of (non-obvious ?) rules and 
everything else is taken from the surrounding/existing code. We shouldn't be 
too nitpicking to not repel newcomers.
We also have lot's of style exceptions to increase human readability.

So I'm not sure about automatic beautifying yet.

Example code
```
#ifdef A
#       ifdef B
#               include <x.h>
#       endif
#endif

int
        method(const char *s, int i) FUNCTION_ATTRIBUTE;

struct A {
        char
                *s1,
                *s2;
        int
                x;
};

int method(const char *s, int i)
{
        if (i == 1)
                s = "foo"; // default

        switch (i) {
        case 0:
                s = "none";
                break;
        default:
                goto label;
        }

        printf("s=%s\n", s);

label:
        return 0;
}
```

Currently my `.indent_pro` has
```
-linux
-ut
-as
-ntac
-ts4
-ppi2
-nlps
-l120
-ip4
-i4
-il0
-di4
-c0
-cd0
-dj
```

-- 
Reply to this email directly or view it on GitLab: 
https://gitlab.com/gnuwget/wget2/merge_requests/370#note_167973900
You're receiving this email because of your account on gitlab.com.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]