升压认为是有害的? [英] Boost considered harmful?

查看:161
本文介绍了升压认为是有害的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

答案C ++的问题大量的这里包含响应:

Lots of the answers to C++ questions here contain the response:

您应该使用升压::(插入
  在这里你最喜欢的智能指针)或
  更好的提升::(插入您的
  最喜欢的超级复杂的升压型
  这里)

"You should be using boost::(insert your favourite smart pointer here) or even better boost::(insert your favourite mega complex boost type here)"

我并不相信,这是做任何好处的提问谁,和大,是显而易见的C ++新手。我的理由如下:

I'm not at all convinced that this is doing any favours to the questioners who, by and large, are obvious C++ novices. My reasons are as follows:


  • 使用智能指针,而不
    了解什么是下回事
    引擎盖将会导致
    新一代C ++程序员谁
    缺少一些的基本功
    程序员。 pretty多,这似乎
    发生在Java领域
    了。

  • Using smart pointers without understanding what is going on under the hood is going to lead to a generation of C++ programmers who lack some of the basic skills of a programmer. Pretty much this seems to have happened in the Java field already.

决定哪种类型的智能指针
要使用非常依赖于
问题域正在解决。这个
几乎总是从丢失
问题张贴在这里,所以索性
说使用一个共享的指针是
可能是在至少无益
并可能完全错误的。

Deciding which type of smart pointer to use depends very much on the problem domain being addressed. This is almost always missing from the questions posted here, so simply saying "use a shared pointer" is likely to be at the least unhelpful and possibly totally wrong.

升压还没有的C ++的一部分
标准,并且可以不提供
特定平台提问
是使用。安装这是一个有点
痛苦(我只是做了它使用果酱)和
是矫枉过正的方法,如果你想要一个是
一些智能指针。

Boost is not yet part of the C++ standard and may not be available on the specific platform the questioner is using. Installing it is a bit painful (I just did it using Jam) and is way overkill if all you want are a few smart pointers.

如果你正在写 FOSS code,你
不想code是重
依赖于外部库,,
再次,用户可能没有。
我一直在推迟使用开放源码软件code上
在多个场合,只是因为
的拜占庭式的复杂性
库之间的依赖关系。

If you are writing FOSS code, you don't want the code to be heavily dependent on external libraries that, once again, your users may not have. I've been put off using FOSS code on a number of occasions simply because of the Byzantine complexity of the dependencies between libraries.

要总结,我不是说不要推荐升压,但这样做的时候,我们应该更加小心。

To conclude, I'm not saying don't recommend Boost, but that we should be more careful when doing so.

推荐答案

几点:


  • 使用任何不求甚解被认为是有害的。但这只是谁得到最终烧毁了无知的技术用户(和他的经理)。

  • 您不必安装提振获得智能指针 - 它们只标头。安装本身是相当简单的,最简单的方法只是输入一个或两个命令。

  • 很多Boost库和解决方案都在TR1 present或将成为C ++ 0x中
  • present
  • 您总是取决于外部库...尽量选择在维护和支持方面有一个光明的未来之一。

  • 除非你想转出你的定制解决方案 - 这将有一些优点和缺点

  • Using anything without understanding is considered harmful. But it is only the ignorant technology user (and his manager) who gets burned in the end.
  • You don't have to install boost to get the smart pointers - they are header only. And installation itself is rather straightforward, in the simplest approach just typing one or two commands.
  • Many of the Boost libraries and solutions are present in TR1 or will be present in C++0x
  • You will always depend on external libraries... Try to choose the one that have a bright future in terms of maintenance and support.
  • Unless you want to roll-out your custom solution - which would have some advantages and disadvantages.

这篇关于升压认为是有害的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆