C++:自动减少编译时依赖的工具
阅读有关 pimpl 习语后,我感到震惊!
是否没有一个工具可以检查 .h/.cpp 文件并推断出可以放弃哪些依赖项?
After reading about the pimpl idiom I was horrified!
Isn't there a tool out there that can inspect a .h/.cpp file and deduce what dependencies could be waivered?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
抱歉,没有。 C++仍然依赖预处理源文件,非常机械。大规模 C++ 开发就是为了减少依赖性。在我看来,C++ 根本不适合这类任务。
Sorry, but no there isn't. C++ still relies on preprocessing source files, very mechanical. Large-scale C++ development is all about reducing the dependencies. In my opinion, C++ is simply not suitable for those kinds of tasks.
预编译头文件并不能解决其中的许多问题吗? MS 和 g++ 现在都支持这些。
Does precompiling the headers not solve many of these horrors. Both MS and g++ support these now.
C++ 的静态代码检查是一场噩梦,由于其语法和宏预处理器,我怀疑是否存在像您所描述的那样的工具。
如果它存在,你会对它有什么期望?您希望它为您重构/重写代码吗?添加和/或删除什么?
对我来说听起来是一项艰巨的任务。
Static code inspection for C++ is a nightmare, because of its syntax and macro preprocessor, I doubt there are tools like the one you describe.
If it existed, what would you expect from it? Would you like it to refactor/rewrite code for you? Adding and/or removing what?
Sounds like a daunting task to me.