[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: C++ code indentation for GNU
From: |
Ian Lance Taylor |
Subject: |
Re: C++ code indentation for GNU |
Date: |
Mon, 15 Jul 2019 07:18:43 -0700 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) |
James Youngman <address@hidden> writes:
> In the same spirit, I'd like to discuss how C++ code should be laid
> out in GNU. As I'm sure you've found before, discussion of code
> layout can give rise to immense amounts of bike-shedding. Hence I'd
> like to propose a somewhat narrow scope for this discussion:
>
> 1. I'd like to retain the spirit of the GNU C style rules. I'd
> prefer not to change things for the C++recommendations which would
> imply changes to the C recommendations for the sake of consistency.
> 2. I'd like it to be possible to update GNU tooling (e.g. Emacs' C++
> mode, perhaps GNU indent). Maybe that means helping make those
> changes, or just ensuring that our recommendations are clear and
> specific, with examples.
> 3. I'd like us to consider how our recommendations would likely be
> received by GNU contributors generally. Making recommendations that
> are widely ignored would be a waste of time.
When discussing formatting, we should keep the clang-format tool in mind
(https://clang.llvm.org/docs/ClangFormat.html). It's from the LLVM
project, and it's not under the GPL, but it is free software. We should
adopt a standard .clang-format file for GNU code. And, of course,
ideally someone would add the same functionality to GNU indent.
As far as the actual formatting goes, I don't see any reason not to
follow the format used by the GCC source code
(https://gcc.gnu.org/codingconventions.html#Cxx_Formatting). To me it
seems like a straightforward extension of the GNU C formatting
conventions.
Ian