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

Brendan Long self at brendanlong.com
Thu Jan 2 13:48:49 PST 2014


On Thu, 2014-01-02 at 13:12 -0800, Geoffrey Garen wrote:


> 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


It would be nice if we could use this with Type::create() functions too,
like:

auto track = AudioTrackPrivateGStreamer::create(...);

Unfortunately the type would be PassRefPtr, not RefPtr, which would
probably not be what we want. Maybe we could do it by just removing
PassRefPtr and adding a move constructor to RefPtr?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-dev/attachments/20140102/e07166e9/attachment.html>


More information about the webkit-dev mailing list