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

> I on my part (in spite using C myself) think that typing code is not that problem, but typing the right code.

What do you think of the auto keyword in C++? I've personally never found typing out the types to be a problem.




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:

http://stackoverflow.com/questions/252671/auto-c-c/12573433#...

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




Applications are open for YC Winter 2018

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

Search: