[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: C++ code indentation for GNU
From: |
Niels Möller |
Subject: |
Re: C++ code indentation for GNU |
Date: |
Thu, 15 Aug 2019 07:56:04 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (berkeley-unix) |
James Youngman <address@hidden> writes:
> It seems to me that if the class name is the right thing to provide as
> context in "git diff" then it would be better were it able to do so
> whatever the indentation of the protection labels.
For a tool like git or gnu diff to identify the top-level thing changed,
it either needs to understand C++, i.e., cooperate with the C++ compiler
in some way, or go by simpler conventions on how programs are written.
It's not just about git; it's useful to be able to operate on source
code with general text utilities which don't build a complete and
correct parsetree.
That definitions of top-level things start with an unindented line is
one such helpful and fairly well established convention. I would guess
the reason diff -p and git consider an unindented foo: as a top-level
definition is that some other languages use that syntax.
Regards,
/Niels
--
Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677.
Internet email is subject to wholesale government surveillance.