[webkit-dev] When to use "auto"? (I usually consider it harmful)

Alexey Proskuryakov ap at webkit.org
Thu Jan 2 13:46:14 PST 2014


02 янв. 2014 г., в 13:12, Geoffrey Garen <ggaren at apple.com> написал(а):

> I think an appropriate style guideline for “auto” would say something like:
> 
> - Use “auto" to declare a disgusting templated iterator type in a loop
> - Use “auto… ->" to define a template-dependent return type in a class template
> - In all other cases, use an explicit type declaration

+1

What do you think about these examples?

    auto failureCallback = [promiseWrapper]() mutable {
        promiseWrapper.reject(nullptr);
    };

…

    auto iter = m_nameToIdentifierMap.find(name.isolatedCopy());
    if (iter == m_nameToIdentifierMap.end())
        return false;

- WBR, Alexey Proskuryakov

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


More information about the webkit-dev mailing list