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

Sean Silva via cfe-dev cfe-dev at lists.llvm.org
Tue Nov 10 21:22:03 PST 2015


On Tue, Nov 10, 2015 at 9:29 AM, Richard via cfe-dev <cfe-dev at lists.llvm.org
> wrote:

>
> [Please reply *only* to the list and do not include my email directly
> in the To: or Cc: of your reply; otherwise I will not see your reply.
> Thanks.]
>
> The comments on this check seem to be asking for the *reverse* check:
>
> switch everything to use auto
>

Commenting from the sidelines, I see two things:
1. For more "traditional" (for lack of a better term) C++ codebases,
removing "unnecessary" uses of the -> syntax is probably a worthwhile thing
on the grounds of consistency (we would probably want something like that
in LLVM, not that we seem to have that problem in LLVM). I.e., the policy
is roughly "use the -> syntax only where strictly necessary, but otherwise,
for consistency, use the traditional syntax"
2. The `auto f() -> T` syntax opens up a new style altogether, and green
pasture projects might want to uniformly use that style.

So I think your original post is basically about 1. and some commenters
have noted the existence of 2.

They're basically separate use cases and I don't think one should hold up
the other as far as writing clang-tidy checks. Do you know of any projects
that are having issues with -> being used "unnecessarily"?

-- Sean Silva


>
> Yes?
> --
> "The Direct3D Graphics Pipeline" free book <
> http://tinyurl.com/d3d-pipeline>
>      The Computer Graphics Museum <http://ComputerGraphicsMuseum.org>
>          The Terminals Wiki <http://terminals.classiccmp.org>
>   Legalize Adulthood! (my blog) <http://LegalizeAdulthood.wordpress.com>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20151110/bf007412/attachment.html>


More information about the cfe-dev mailing list