Jon Chesterfield via llvm-dev
2019-Apr-25 08:07 UTC
[llvm-dev] Coding style. VariableNames, not variableNames?
Hey, A colleague just pointed out that the style guide says: *Variable names* ... should be camel case, and start with an upper case letter 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? 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? As an edge case, should function pointers be leading lower case (as they're functions) or leading upper case (as they're variables)? Cheers, Jon -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190425/edc2b9fd/attachment.html>
Tim Northover via llvm-dev
2019-Apr-25 09:38 UTC
[llvm-dev] Coding style. VariableNames, not variableNames?
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): https://reviews.llvm.org/D57896, https://lists.llvm.org/pipermail/llvm-dev/2019-February/130083.html> 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. Cheers. Tim.
Jon Chesterfield via llvm-dev
2019-Apr-25 10:28 UTC
[llvm-dev] Coding style. VariableNames, not variableNames?
Hey Tim, It's not a recent change, but there has been a recent thread about> switching to variableNames (amongst other things): > https://reviews.llvm.org/D57896, > https://lists.llvm.org/pipermail/llvm-dev/2019-February/130083.htmlThanks for the link. Owing to my poor reading of the coding style, our out of tree back end is lowerCased. Sad times. I'll watch the RFC with interest. Cheers, Jon>-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190425/2ce32247/attachment.html>