[llvm-dev] Variable names rule
JD Jones via llvm-dev
llvm-dev at lists.llvm.org
Mon Feb 4 13:26:48 PST 2019
Yeah, I hated it too at first. It grew on me. After about a week or so, it does make it easy to differentiate between different kinds of elements at a quick glance, can be more readable than a single or two character identifier, doesn't take up much horizontal space (considering LLVM allows only 80, that should be a consideration...unless that, too, is under discussion?) can be very pronounceable, and when documentation is created from it, allows the reader of that documentation to quickly differentiate between different kinds of elements as well.
From: llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] On Behalf Of Krzysztof Parzyszek via llvm-dev
Sent: Monday, February 4, 2019 2:51 PM
To: llvm-dev at lists.llvm.org
Subject: Re: [llvm-dev] Variable names rule
On 2/4/2019 2:29 PM, Tim Northover via llvm-dev wrote:
> On Mon, 4 Feb 2019 at 20:21, JD Jones <jjones at prc-hsv.com> wrote:
>> If _<lowerCaseLetter> violates a standard, please say which one. It does not violate the C++11 standard:
> If strictly adhered to, it doesn't, and I've never claimed any
> different. But coding standards are never strictly adhered to.
> Particularly not in a codebase like LLVM which already has a good
> handful in play for historical reasons. We can't expect reviewers to
> be perfect either, and violations of a leading underscore rule have a
> ridiculously high probability of producing malformed C++.
> It's simply not worth the aggro when there are plenty of other
> possibilities available that don't open us up for that failure mode.
IMO, any convention that contains leading or trailing underscores should be rejected outright. The primary purpose of a convention is to allow a person to differentiate between different kinds of elements with a quick glance. It should strive to make these elements appear different without sacrificing the readability. Prepending or appending a lone underscore is really making the identifier as similar to another one as possible, while still making it different from the language standard point of view, i.e. the opposite to what a useful convention should do.
LLVM Developers mailing list
llvm-dev at lists.llvm.org
This message is intended for the addressee only and may contain Paragon
Research Corporation (PRC) confidential or privileged information. Use or
distribution of such confidential information is strictly prohibited
without the prior written permission of PRC. If you have received this
message in error, please contact the sender immediately and delete the
message and attachments from your computer.
More information about the llvm-dev