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

Darin Adler darin at apple.com
Mon Jan 6 15:34:38 PST 2014


On Jan 6, 2014, at 1:49 PM, Geoffrey Garen <ggaren at apple.com> wrote:

> FunctionParameters::FunctionParameters(ParameterNode* firstParameter, unsigned size)
>     : m_size(size)
> {
>     unsigned i = 0;
>     for (ParameterNode* parameter = firstParameter; parameter; parameter = parameter->nextParam()) {
>         auto pattern = parameter->pattern();
>         pattern->ref();
>         patterns()[i++] = pattern;
>     }
> }
> 
> If I had to describe this algorithm in English, I’d say, “Collect and retain all the [auto] from the list of parsed parameters.” I think that explanation would be stronger if “[auto]” were a concrete noun.

The variable and the function are both named pattern and I would use that as the noun.

— Darin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-dev/attachments/20140106/3b1670fa/attachment.html>


More information about the webkit-dev mailing list