[llvm-dev] Variable names rule

Matt Arsenault via llvm-dev llvm-dev at lists.llvm.org
Mon Feb 4 12:15:17 PST 2019

> On Feb 4, 2019, at 9:20 AM, via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> IIRC the last time around there was strong agitation to make function names and variable names look different, which made no sense to me because their contextual syntax makes it blatantly obvious whether a name is a function or a variable. The only possible situation where you could be confused is assigning a function to a function-pointer, which in typical C++ basically you never do that.

I think it’s more important to distinguish types and variables. Variables should be lowercase and distinguished from uppercase types. For some reason it’s allowed to shadow types with variable names, so we end up with quite a bit of code using variable names like “Value” which is also a class. This is made worse by the fact that lldb doesn’t recognize this, so when you try to print “Value” it’s confused since that’s a type. I’ve wasted a lot of time renaming variables when debugging just to avoid this problem. I assume this has never been fixed since pretty much every other naming convention doesn’t uppercase variables.

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

More information about the llvm-dev mailing list