[llvm-dev] Variable names rule

Chris Lattner via llvm-dev llvm-dev at lists.llvm.org
Sat Feb 2 20:19:11 PST 2019

> On Feb 2, 2019, at 8:18 PM, Chris Lattner <clattner at nondot.org> wrote:
>> On Feb 1, 2019, at 6:20 AM, Michael Platings via llvm-dev <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote:
>> Hi all,
>> As application of the naming rules are currently under discussion [1] this seems like a good time to bring this up:
>> The current variable naming rule [2] states: Variable names should be nouns (as they represent state). The name should be camel case, and start with an upper case letter (e.g. Leader or Boats).
>> I'm a relatively new arrival to the LLVM codebase and I want to follow the rules wherever I can, but I humbly submit that this rule is suboptimal for readable code.
>> The rationale given at the time this rule was added was "document the prevailing convention" [3].
> I completely agree with you that our variable naming rule is broken.  This discussion has been brought up before (e.g. http://lists.llvm.org/pipermail/llvm-dev/2014-October/077685.html <http://lists.llvm.org/pipermail/llvm-dev/2014-October/077685.html>) and hasn’t made any progress - people seem to not be willing to make a change, e.g. saying "the cure is worse than the disease".  I’m personally in favor of Nick’s proposal (linked above) which makes variable names and function names be lower camel case.  

It’s worth noting that at the time, if I recall correctly, I argued against Nick’s proposal.  I’m since come around to see the wisdom of his position and agree that we should have done it.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190202/96aa9eae/attachment.html>

More information about the llvm-dev mailing list