gpt4 book ai didi

c++ - boost::interprocess::managed_shared_memory 在不同版本的 boost 之间的兼容性

转载 作者:可可西里 更新时间:2023-11-01 16:46:32 28 4
gpt4 key购买 nike

是否有明确的兼容性保证 boost::interprocess::managed_shared_memory 可以跨不同的 boost 版本工作?我打算用它在多个进程之间共享一个整数或十(这实际上将充当它们都读取和写入的一段数据的修订号)。这些进程是单独发布的,并且偶尔会终止使用。

问题是:我是否会因为 1.51 中的 managed_shared_memory 无法与 1.44 中的 managed_shared_memory 进行对话而将自己永远锁定在给定的 boost 版本上?

最佳答案

根据Boost FAQ :

How can the Boost libraries be used successfully for important projects?

Many of the Boost libraries are actively maintained and improved, so backward compatibility with prior version isn't always possible. Deal with this by freezing the version of the Boost libraries used by your project. Only upgrade at points in your project's life cycle where a bit of change will not cause problems. Individual bug fixes can always be obtained from the boost repository.

因此,您似乎将自己锁定在一组 Boost Interprocess 的 future 版本中,这些版本将与您将使用的版本兼容,这是不可预测的版本数量(明天可能会破坏兼容性)以及它永远不会被打破)。

如果您有能力在新版本的 boost 出现并破坏兼容性时投入一些时间来改进您的代码,那么您就没事了。在实践中,我认为这更有可能每隔几年发生一次,而不是每月一次,库制造商倾向于在发布更新之前考虑向后兼容性。

关于c++ - boost::interprocess::managed_shared_memory 在不同版本的 boost 之间的兼容性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13187063/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com