To which extent is “boost does it” equivalent to “very portable, use it”?

China☆狼群 提交于 2019-12-23 08:51:02

问题


In this answer to a question asking "is doing Z this way portable" the idea is "boost does it this way, it means it is very portable".

Can I just always consult boost sources to find the most portable way of doing something in C++? How can I judge for myself if boost is really such a collection of super-portable code?


回答1:


There are some cases where Boost libraries exist precisely because they wrap very non-portable code. The most obvious examples are the file system and threading stuff.

The telltale sign of this is a large use of Boost.Config macros. Boost code that doesn't depend on Boost.Config (or other non-standard #ifdefs) will be highly portable.




回答2:


Boost is prety well tested against a variety of operating systems

Check out this page




回答3:


Boost comes with some guidelines on how to program for portability; libraries are throroughly peer reviewed before acceptance -- although compiler support can be dropped for particular libraries if there is no reasonable way of implementing the libraries Raison d'être, and the library brings break-through concepts -- e.g., boost::mpl didn't work well on sun compilers for a long time.

So, yes you can just consult the sources of libraries -- however, expect a major headache, portable coding requires levels upon levels of indirection.



来源:https://stackoverflow.com/questions/2342037/to-which-extent-is-boost-does-it-equivalent-to-very-portable-use-it

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!