this post was submitted on 31 Jan 2025
8 points (90.0% liked)
C++
1838 readers
5 users here now
The center for all discussion and news regarding C++.
Rules
- Respect instance rules.
- Don't be a jerk.
- Please keep all posts related to C++.
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I'm unsure if that's even possible in C++ for a "normal program" instead of requiring a full-fledged compiler and even maybe a linker, as C++ syntax is completely context-dependent. There's no way to tell if
i+=b;
increments a value or is actually a dynamic hierarchy cast that prints a message to screen and invokes a vector copy with data downloaded from the internet.I'd venture there's something in Clang that does this? (clang-tidy, clang-format, who knows), since they implement the syntax tree parser thing.
This is a lot more complicated than I first anticipated. I guess its probably not a common tool then ๐
Whch is why the cool thing(TM) nowadays is to use an IDE that has Clang integration, and let the compiler that already compiles your code anyway, do all that sweet statistics job for you.