4 ms·
But this introduces inconsistency and hurts readability and maintanability: sometimes auto, sometimes not, purley based on some arbitrary limit of amount of cha
by stinos 8y ago
But this introduces inconsistency and hurts readability and maintanability: sometimes auto, sometimes not, purley based on some arbitrary limit of amount of characters in the type name? I'm not advocating everything must be auto but surely there's better and more consistent rules than that.
- IshKebab 8y agoI don't think it is an important inconsistency and I don't see why it would hurt maintainability. Maybe you're thinking "you can't change return types easily" but in practice the situations where you can change a return type without altering calling code at all are extremely rare. Also, I agree that there could be a better solution - always use auto, and use an IDE which shows you the type inline. IntelliJ can do this for Rust. But unfortunately no C++ IDE has code intelligence anywhere near good enough to do this reliably.
- jcelerier 8y ago> Also, I agree that there could be a better solution - always use auto, and use an IDE which shows you the type inline. IntelliJ can do this for Rust. But unfortunately no C++ IDE has code intelligence anywhere near good enough to do this reliably. I guess it depends on the IDE, here's what the one I use (QtCreator) can do for instance : https://i.imgur.com/SebyTR9.png https://i.imgur.com/SebyTR9.png
- IshKebab 8y agoI used QtCreator. It's good but not reliable or fast enough for large projects.