预编译头文件是隐藏代码的好方法吗?

huangapple go评论59阅读模式
英文:

Are precompield headers a good way to hide code?

问题

我一直在做一个项目,最好能隐藏头文件的内容。我最近想到了预编译头文件。这些东西有多有效的使用案例呢?

英文:

I've been working on a project where preferably I would hide the contents of the header files. I came to the idea recently of precompiled headers. How valid of a use case are these things?

答案1

得分: 0

对于未来的任何人来说,预编译头文件不是解决方案,因为其输出不是平台无关的。应优先使用pimpl模式[或类似概念]。

英文:

For anyone in the future, a precompiled header is not the answer simply because its output is not platform independent. Use of the pimpl idiom [or similar concepts] should be greatly preferred.

huangapple
  • 本文由 发表于 2023年4月17日 02:48:25
  • 转载请务必保留本文链接:https://go.coder-hub.com/76029723.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定