[Dnsmasq-discuss] code style, decision

Kristoffel Pirard kristoffel.pirard at gmail.com
Thu Sep 12 12:23:54 BST 2019


My 5 cents:

1. It saved my team a lot of discussion when we enforced a code formatter
(e.g. clang-format).
2. 5 levels of indentation is way deeper than most humans can have in their
heads simultaneously - functions are a great tool to alleviate this.


On Thu, Sep 12, 2019 at 10:36 AM Dominik <dl6er at dl6er.de> wrote:

> If we change anything at all, we should not solely use tabspace.
>
> Imagine only when we're at level 5 in the code, this works mean 5*8=40
> (useless) indentation space before the actual code starts. This makes the
> code rather unreadable when editing with CLI tools like vim where there is
> typically less displaying slave available than in fancy IDE applications.
> Note that many editors jump back to the very beginning when there is an
> empty line.
>
> If at all, I'd vote for converting the existing tabstops to 8 spaces and
> keep the indentation step of 2 spaces per level.
>
> Best,
> Dominik
>
> >On Wed, Sep 11, 2019 at 03:09:31PM -0700, Shota Hino wrote:
> >> On Wed, Sep 11, 2019 at 2:49 PM Simon Kelley wrote:
> >> > On 11/09/2019 22:12, Shota Hino wrote:
> >> > > On Wed, Sep 11, 2019 at 2:05 PM Simon Kelley wrote:
> >> > > > On 07/09/2019 18:21, john doe wrote:
> >> > > > >   some earlier postings:
> >> > > > > >   ....
> >> > > > >
> >> > > > > I agree, consistent code is best, clear guideline could be
> >> > > > > usefull for new code.
> >> > > > >
> >> > > > > Simon Kelley, the belligerent dictator of the Dnsmasq project
> >> > > > > will need to way in on such changes though.
> >> > > >
> >> > > > There seems to be confusion here between code style, and code
> >> > > > representation.
> >> > > >
> >> > > > Code style, ie layout, indent width, is not negotiable.
> >> > > >
> >> > > > Code representation is the use of tab characters at 8-character
> >> > > > stops.  If your IDE or other device doesn't use 8 characher
> >> > > > stops, it will mangle code. That doesn't mean the code is badly
> >> > > > formatted, it means your display method is incompatible.
> >> > > >
> >> > > > It's quite possible to get around this by running expand on
> >> > > > every commit, so that only spaces are used in the repo. It's
> >even
> >> > > > possible to run expand on every existing file, at the expense
> >of
> >> > > > polluting the logs.  I don't think there are any other
> >downsides
> >> > > > to this.
> >> > > >
> >> > > > Or people could  configure IDEs and editors to use sane tab
> >stops.
> >> > > >
> >> > > > Cheers,
> >> > > >
> >> > > > Simon.
> >> > > >
> >> > > How do you feel about the mix usage of tab and leading white
> >spaces?
> >> > > The code is mangled because some liens use a tab and some use
> >white spaces.
> >> > > I do not think the choice of tab vs white spaces is code
> >representation.
> >> >
> >> > With tab stops set to 8, a single tab or eight spaces are just
> >alternate
> >> > representations of the same thing, surely?
> >> >
> >> >
> >> > Simon
> >> >
> >>
> >> Yes.
> >>
> >> But what I am asking in this thread is to use either tabs or white
> >spaces
> >> (not both).
> >> If only one is used, the width of tab in IDE does not matter.
> >
> >Now it waits for a decision.
> >
> >With which character should the code be indented?
> >
> >
> >Regards
> >Geert Stappers
> >
> >_______________________________________________
> >Dnsmasq-discuss mailing list
> >Dnsmasq-discuss at lists.thekelleys.org.uk
> >http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
>
> _______________________________________________
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss at lists.thekelleys.org.uk
> http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20190912/1b3d12d0/attachment.html>


More information about the Dnsmasq-discuss mailing list