[webkit-dev] [webkit-reviewers] usage of auto

Alex Christensen achristensen at apple.com
Tue Jan 10 23:09:05 PST 2017


>> I’d love to see examples where using auto substantially hurts readability so we could debate them.
I once saw a RefPtr<Something> changed to auto in some generated code where it was unclear what the return type was.  For at least one generated instance the return type was Something* that needed a reference kept alive by the caller, so this change caused a subtle use-after-free bug.  See https://trac.webkit.org/changeset/201345 <https://trac.webkit.org/changeset/201345>

Also when we change what a return type is but there are call sites that use auto, we may miss checking to see if everything is ok at a call site that compiles successfully even though it has different meaning.

I’ll admit auto has grown on me quite a bit since I wrote https://lists.webkit.org/pipermail/webkit-dev/2014-January/026000.html <https://lists.webkit.org/pipermail/webkit-dev/2014-January/026000.html>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-dev/attachments/20170110/fb8150ee/attachment.html>


More information about the webkit-dev mailing list