[llvm] r264314 - [docs] Clarify Error example in Programmer's Manual.
Rafael Espíndola via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 24 11:52:17 PDT 2016
On 24 March 2016 at 14:46, David Blaikie <dblaikie at gmail.com> wrote:
>
>
> On Thu, Mar 24, 2016 at 11:37 AM, Rafael Espíndola
> <llvm-commits at lists.llvm.org> wrote:
>>
>> So, what I meant in the other "example review" is that while I
>> personally like using auto in here, it seems in conflict with the
>> current rule:
>>
>>
>> ----------------------------------------------------------------------------
>> Don’t “almost always” use auto, but do use auto with initializers
>> likecast<Foo>(...) or other places where the type is already obvious
>> from the context.
>
>
> I'd say this fits the "already obvious from context" in this example - the
> return type is only a few lines away, the name indicates that it's an error
> result & the more details about the type aren't very helpful in this context
> "it's an error that's being propagated" - we don't need to know much more
> about it.
>
> I don't think this use of auto should be seen as integral to the example -
> just appropriate in that context & the use of auto when passing around
> errors should be evaluated as usual in a case-by-case basis as per the style
> guide.
>
> At least that's my guess/feeling.
I agree that the type doesn't add much. How about explicitly saying
that it is OK to use auto when just propagating errors?
Cheers,
Rafael
More information about the llvm-commits
mailing list