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

> Use types when they are needed and use the tools at your disposal (IDEs BT every text editor has clang language server integration nowadays)

While I agree that auto is helpful, the amount of times I had to wait for clangd (or whatever the IDE is using) to parse a .cpp file and deduce the underlying type is frustrating. It happens too often with every IDE (Qt Creator, CLion, VS Studio, VS Code, etc...) I've tried whenever I'm programming with a non-desktop machine that's not super beefy.

Plus I often use Github to search for code when I'm trying out a new lib so having the type spelled out is extremely helpful.




Plus assuming that your codebase is clangd parseable. Many aren't out of the box.

Plus assuming that you're not reading/modifying code on a (remote) machine where you don't have access to IDEs but simple editors only.

Otherwise, I also find auto helpful but I use it sparingly, mostly where type is obvious, e.g. can be easily deducted from the local scope.


One approach is use auto while coding, auto convert to full types when finalizing/commiting except where they hurt readability.




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: