开发者

Tool that will check for redundant includes in C++ project

I need a tool that will sca开发者_高级运维n my C++ project to see if there are any includes that are not being referenced or are being referenced redundantly. Thanks.


You don't want this. You want to include any header that declares/defines anything used by the cpp file you're writing. If you remove "redundant" headers that are already included by something you're including then when something minor changes you'll be editing files all over the damn place. Just use proper header guards to make sure you don't break the one-definition rule.


As for the tool - hard to imagine how should it work (at least from my limited point of view).

What I do is commenting out each include line and rebuilding the file (only one file - not the complete project). If it stil compiles - the inclusion was not needed.

Should not take too much time.

Off-topic: I can see the need of this procedure before delivering the code to the customer. I would appreciate the deliverables more knowing that somebody has taken care even of that tiny detail. But as a customer, I wouldn't be so picky to insist on it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜