Hacker News new | ask | show | jobs
by yakubin 1764 days ago
In C++, preprocessor and template magic in dependencies tends to break such IDE convenience features as "go to definition" or "find all references".
2 comments

This almost doesn't happen when your tools are good. At Google the Kythe tool (https://kythe.io) gracefully deals with templates, macros, and much more. Both "go to definition" and "find references" just work with 99.9% of C++ code, including within complicated macros and templates.

(The one and only case I've ever found it doesn't work is to find references to a function that's only called via ADL in a widely used template that's instantiated with thousands of different types.)

What about SFINAE?
Works. Because it uses the compiler to figure out what calls what, and so the compiler has already selected the right overload.
tbh I've had dramatically worse type-aware IDE features with Go than almost any other mainstream language. gopls routinely misses trivial things in the same file. Goland does substantially better, but it still has major problems gathering a complete call hierarchy, and basic things like moving a file to a different package (with no compilation issues, just import rewrites) still don't work reliably.