On Tue, Jun 2, 2015 at 1:23 PM, L. David Baron <dba...@dbaron.org> wrote:

> On Tuesday 2015-06-02 22:58 +0300, smaug wrote:
> > So, I'd like to understand why people think 'auto' is a good thing to
> use.
> > (bz mentioned it having some use inside bindings' codegenerator, and
> sure, I can see that being rather
> > valid case.)
>
> One context where I think it often makes sense is for integral
> types, e.g., for things like:
>
>   auto len = aArray.Length();
>   auto display = GetStyleDisplay()->mDisplay;
>
> It can save having to look up whether aArray.Length() returns size_t
> (I sure hope it does, though) or whether mDisplay is uint8_t or
> uint16_t.


It also makes a lot of sense in situations where the type name is noise.
e.g.

auto foo = reinterpret_cast<ReallyLongTypeName*>(bar)
auto it = map.find(stuff)

- Kyle
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to