[RFC] Increase libstdc++ line length to 100(?) columns

Richard Biener richard.guenther@gmail.com
Fri Nov 27 08:14:33 GMT 2020


On Fri, Nov 27, 2020 at 3:48 AM Liu Hao via Gcc <gcc@gcc.gnu.org> wrote:
>
> 在 2020/11/27 上午7:50, Jonathan Wakely via Gcc 写道:
> > I've touched on the subject a few times, e.g.
> > https://gcc.gnu.org/pipermail/gcc/2019-December/230993.html
> > and https://gcc.gnu.org/pipermail/gcc/2019-December/231013.html
> >
> > Libstdc++ code is indented by 2 columns for the enclosing namespace,
> > usually another two for being in a template, and is full of __
> > prefixes for reserved names. On top of that, modern C++ declarations
> > are *noisy* (template head, requires-clause, noexcept-specifier, often
> > 'constexpr' or 'inline' and 'explicit', and maybe some attributes.
> >
> > All that gets hard to fit in 80 columns without compromising
> > readability with line breaks in unnatural places.
> >
>
> I think I want to vote +1 for this. On my 1920x1080 laptop screen with an 11pt monospace font, 100
> colons allows me to open two terminals side by side, while still providing 3 colons for line
> numbers. On a larger desktop screen with a 10pt font it'd be 132 colomns, but more often I find
> lines longer than 110 characters hard to read, so I agree with 100 (but I suggest making it a
> 'recommended limit' instead of a 'hard limit' anyway).
>
>
> There was a small fragment of code in <https://gcc.gnu.org/pipermail/gcc/2019-December/231003.html>:
>
> >                       if (present)
> >                         ptr
> >                           = gfc_build_conditional_assign_expr (block, present,
> >                                                                ptr, nullarg);
>
> Why not change this to:
>
> >                       if (present)
> >                         ptr = gfc_build_conditional_assign_expr (
> >                             block, present, ptr, nullarg);
> >
>
> I think it looks balanced and way more comfortable, and doesn't waste much leading space.

Other places use

       if (present)
         ptr = gfc_build_conditional_assign_expr
                                  (block, present, ptr, nullarg);

I prefer the ( on the next line.  The argument list can be two spaces
indented from
the function name or "right justified" (I think the latter looks
visually better).

Richard.

>
>
>
> --
> Best regards,
> LH_Mouse
>


More information about the Gcc mailing list