[cfe-dev] RFC: clang-tidy readability check to reduce clutter: unnecessary use of auto and ->

Robinson, Paul via cfe-dev cfe-dev at lists.llvm.org
Thu Nov 12 09:50:07 PST 2015


> One thing that bothered me though is that the keyword 'auto' was reused
> simply because... it was there. There's nothing "auto" going on in any
> sense of the word.

'static' is much worse... in any context other than a function-local
variable, it's just a completely arbitrary we-already-had-this-reserved
keyword. Put it on a file-level variable, and it determines... visibility!
Put it on a class method, and... something with no one-word description
happens!  There really is no possible English definition of 'static' that
could apply to either of those cases.

OOTC:
'auto' applied to a return-type could at least be interpreted as
"automatically decide what this type is" so 'auto' is kind-of sensible
there.  Although I have to say, 'let' has some appeal.
--paulr



More information about the cfe-dev mailing list