Re: [dev] [dmenu] [PATCHES 1-5] Changes and cleanup

From: Dimitris Papastamos <sin_AT_2f30.org>
Date: Tue, 23 Dec 2014 15:22:06 +0000

On Tue, Dec 23, 2014 at 04:11:16PM +0100, k0ga_AT_shike2.com wrote:
>
> >> The style(9)-changes were absolutely necessary and it's better to do this
> >> as early as possible instead of waiting and waiting until it's too late
> >> and you have a really big number of patches for a given program.
> >
> > The thing I dislike most about the style changes is the alignment of
> > variable and function definitions, and the reason I don't like
> > alignment-based definitions is because the moment you need to add a new
> > variable or function that has a column that's one character longer than
> > the existing definitions, you end up with a diff that modifies a bunch
> > of a lines that are not necessarily related to the new feature.
> >
>
> I agree with Eric here. I don't see the point of variables alignment.

I recently started experimenting with a different style.

Consider the following:

struct foo {
        int a;
        char b;
        unsigned int c;
        struct foo *next;
};

This gets converted to:

struct foo {
        int a;
        char b;
        unsigned int c;
        struct foo *next;
};

They are not semantically aligned based on type but blindly based on
the first field. If you had a user-defined type which was overly
long then you ignore it. For example:

typedef struct {
        . . .
} SomethingInsane

struct foo {
        int a;
        SomethingInsane blah;
        struct foo *next;
};

So adding a new member doesn't really require realigning everything.
If it is too long, it is not aligned.

You can apply this to records, local variables and global variables.

What do you think? I never really did any alignment before but sometimes
the result looks nicer.
Received on Tue Dec 23 2014 - 16:22:06 CET

This archive was generated by hypermail 2.3.0 : Tue Dec 23 2014 - 16:24:07 CET