Indentation

Divan Burger divan.burger at gmail.com
Thu Jan 10 08:50:09 CST 2008


On 10/01/2008, Maarten Lankhorst <maarten at codeweavers.com> wrote:
> Divan Burger schreef:
> > Hi,
> >
> > What is the preferred number of spaces of indentation? In
> > comdlg32/colordlg.c it is either one or three spaces and there are a
> > few places where there is no indentation and where things are randomly
> > indented or switches between amounts of indentation.
> >
> Some of wine's code is a mess with indentation, but alexandre won't
> commit indentation patches.
> This basically means that if there are multiple styles of indentations
> in the same file, you have to pick the one that is around the place
> where you put your function, although secretly when Alexandre isn't
> looking I sometimes pick the preferred '4 spaces' one.
> > What is the policy on when to change indentation and other things like
> > turning something like this:
> >
> >     if (condition)
> >     {
> >         ...some code...
> >         return 0;
> >     }
> >     return 1;
> >
> > into
> >
> >     if (condition)
> >         return 1;
> >
> >     ...some code...
> >     return 0;
> >
> > The page on style
> > (http://www.winehq.org/site/docs/winedev-guide/style-notes) only
> > contains very little on coding style.
> >
> > Another question, would it be OK to use smooth gradients in the colour
> > dialog? It could be slow on older computer accessing each pixel
> > individually although the code is only run on startup.
> >
> Explicit patches that only do that are not accepted as far as I know,
> because it introduces bugs as you just skillfully demonstrated. ;-)
>
> However if you are rewriting the function you might end up doing that
> simplication in the process.
>
> Cheers,
> Maarten
>

Oops, I was thinking about inversing the condition while I was writing it :)
- if (condition)
+ if (!condition)

What about if I change one line or add a line in a small function
(approximately 15 lines). Will I be allowed to change the indentation
or do that simplification above? The one line indentation makes it
difficult to see the code structure sometimes and I also prefer the 4
spaces one.



More information about the wine-devel mailing list