Hacker News new | past | comments | ask | show | jobs | submit login

Hi, I must admit, that I am not totally up-to-date when it comes to C++, since I am not hopping on the newest standards as soon as they are there. And I am not actively programming in C++ currently.

But I don't think, that "auto" was specified to reduce typing. I see it more as a possibility to follow the "DRY" principle (don't repeat yourself).

There might be cases, where for example the return types of functions might change and you don't want to change every caller.

Templates are of course an other example, because the return types of templates oftentimes are depending of the input types. You of course can use those template declaration stuff, but it is very ugly and oftentimes clumsy.

I also found a nice example, where it really can help to make things more easy to read, here:


I think, the real usages are rare, that is also the reason, it was specified rather late.

Applications are open for YC Summer 2020

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact