[cfe-dev] [llvm-dev] RFC: Modernizing our use of auto

George Burgess IV via cfe-dev cfe-dev at lists.llvm.org
Wed Dec 5 23:45:45 PST 2018


So the problem becomes one of seeing if people will accept `auto` rules
that don't require substantial amounts of thought.

Personally, I see this like our use of clang-format. It might not use my
favorite color of paint, but it's uniform, automatic, and it lets me
entirely forget about tons of style nits, so I love it to death. Hence, if
we need to start with "no auto, except in this small set of trivially OK
and machine-verifiable cases, which we'll consider expanding this as need
arises," to get to that, I'd be all for it.

I realize that many devs probably strongly disagree with me here, but
that's my 2c.

On Wed, Dec 5, 2018 at 9:26 PM Chris Lattner <clattner at nondot.org> wrote:

>
>
> > On Dec 4, 2018, at 10:59 AM, George Burgess IV <
> george.burgess.iv at gmail.com> wrote:
> >
> > > I think people are too eager to use `auto` because it is easy to write
> but it makes the types substantially harder for the reader to understand
> >
> > I'm probably the Nth person to ask this, but what keeps us from
> promoting the use of a clang-tidy-powered tool that basically emits fixits
> of s/auto/actual_type/?
>
> Because the tool would need to apply judgement to when this makes sense.
> If we can’t write an algorithm in coding standards.html to be prescriptive
> about when to use auto, then I don’t think we can automate this.
>
> -Chris
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20181205/010580fa/attachment.html>


More information about the cfe-dev mailing list