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

Antti Koivisto koivisto at iki.fi
Sun Jan 5 03:56:57 PST 2014


On Fri, Jan 3, 2014 at 9:28 PM, Geoffrey Garen <ggaren at apple.com> wrote:

> I strongly object to varying coding style arbitrarily based on author or
> project file. That's a recipe for an unreadable polyglot codebase.
>

I wasn't advocating a general coding style free-for-all. I imagine there
could be valid subsystem specific reasons for not deploying 'auto' widely.

> auto& cell = toRenderTableCell(*renderer); // right
> > RenderTableCell& cell = toRenderTableCell(*renderer);  // wrong
>
> Not sure.
>
> These lines of code do not include a verbatim type name, and so they are
> not friendly to cmd-click/select-and-search. Changing the function
> signature to “to<RenderTableCell>”, or something like that, might help.
>

Cmd-click on toRenderTableCell takes you to RenderTableCell.h. I'm
unconvinced this is a practical problem.


  antti
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-dev/attachments/20140105/8928bef2/attachment.html>


More information about the webkit-dev mailing list