>> My take-away from this discussion so far is that there is actually very
>> little consensus on usage of auto, which means there’s probably very little
>> room for actual style guideline rules.
>>
>> I think there are two very limited rules that are probably not objectionable
>> to anybody.
>>
>> 1 - If you are using auto for a raw pointer type, you should use auto*
>> 2 - If you are using auto in a range-based for loop for values that aren’t
>> pointers, you should use (const) auto&
>
> In some cases you need a copy for the code to be correct. I understand why &
> is often better for performance but there is a significant and dangerous
> behavioral difference.
>
> I agree with encouraging people to use auto& because it's usually ok, but I
> disagree with mandating it because it's sometimes wrong.
Seems like we could still have a style guideline in favor of these styles.
Style guidelines are always recommendations, which are of course not followed
if they produce incorrect code. For example, it is S_OK to violate our camel
case guidelines when interfacing with COM APIs.
I think Darin would also suggest:
1.5 - If you are using auto in a range-based for loop for values that are
scalars, you should use auto.
Geoff
_______________________________________________
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev