<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 24, 2016 at 11:52 AM, Rafael Espíndola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 24 March 2016 at 14:46, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br>
><br>
><br>
> On Thu, Mar 24, 2016 at 11:37 AM, Rafael Espíndola<br>
> <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br>
>><br>
>> So, what I meant in the other "example review" is that while I<br>
>> personally like using auto in here, it seems in conflict with the<br>
>> current rule:<br>
>><br>
>><br>
>> ----------------------------------------------------------------------------<br>
>> Don’t “almost always” use auto, but do use auto with initializers<br>
>> likecast<Foo>(...) or other places where the type is already obvious<br>
>> from the context.<br>
><br>
><br>
> I'd say this fits the "already obvious from context" in this example - the<br>
> return type is only a few lines away, the name indicates that it's an error<br>
> result & the more details about the type aren't very helpful in this context<br>
> "it's an error that's being propagated" - we don't need to know much more<br>
> about it.<br>
><br>
> I don't think this use of auto should be seen as integral to the example -<br>
> just appropriate in that context & the use of auto when passing around<br>
> errors should be evaluated as usual in a case-by-case basis as per the style<br>
> guide.<br>
><br>
> At least that's my guess/feeling.<br>
<br>
</span>I agree that the type doesn't add much. How about explicitly saying<br>
that it is OK to use auto when just propagating errors?<br></blockquote><div><br>I'm not sure it adds much to the style guide (I think it's a reasonable interpretation that the type is obvious from context in this case) & keeping the style guide short helps make it accessible/useful.<br><br>If something was added to the guide here I'd probably make it a bit more broad "when the type information isn't useful" (eg: the type is just being passed from one place to another/called with an obvious function, etc) auto might be suitable.<br><br>eg: I can write "foo(bar())" without writing the type of the result of bar, so just because I need to write "x = foo(); bar(x, x)" doesn't mean the type of x is any more important.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Cheers,<br>
Rafael<br>
</blockquote></div><br></div></div>