[llvm-dev] Coding style. VariableNames, not variableNames?

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Thu Apr 25 02:38:37 PDT 2019

Hi Jon,

On Thu, 25 Apr 2019 at 09:07, Jon Chesterfield via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> I was under the impression that variables were supposed to be camel case, without a leading upper case, as currently recommended for function names. Is this a somewhat recent change? If so, could someone share a regex / script for updating the previous style to this one?

It's not a recent change, but there has been a recent thread about
switching to variableNames (amongst other things):

> This implies that the traditional i,j,k loop indices should now be spelled I,J,K. Is is worth making an exception for single character variables where the meaning is implicit from the context?

I certainly would, and it seems most people agree. "int i " seems to
be about 4x as common as "int I ".

> As an edge case, should function pointers be leading lower case (as they're functions) or leading upper case (as they're variables)?

I believe they're mostly upper-case right now (though pretty rare). I
think named lambda helpers vary more but still favour upper-case.



More information about the llvm-dev mailing list