且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

C ++标准库 - 当我应该使用它,什么时候不应该吗?

更新时间:2023-02-16 23:32:19

这是可能你懒惰或固执。就个人而言,我使用他们生产code所有的时间。

It's possible you're being lazy or stubborn. Personally, I use them all the time in production code.

我不这样做,是看中了,因为我喜欢写我不这样做太空时代的code。相反,我这样做是因为我是一个偏执的程序员,我知道,生产环境是充满敌意的地方,这将毁坏code和减少我的计划,吸烟毫无价值的字节桩,如果有机会。

I don't do this to be fancy, and I don't do this because I like writing "space-age code." Rather, I do this because I am a paranoid programmer, and I know that production environments are hostile places that will mutilate code and reduce my programs to smoking piles of worthless bytes, if given a chance.

我这样做是因为我生活的座右铭,***的code,是code,你从来不写。这需要时间来学习如何使用STL和放大器;标准库的有效的,但一旦你做,你会发现,它可以用来使什么现在是1000行code成为可能100这100个可能需要长达写的原来1000,但有较少的故障点。在code可以是更强大的,如果你站在别人的肩膀上。

I do this because I live by the motto, "The best code, is the code you never write." It takes time to learn how to use the STL & Std Lib effectively, but once you do you'll find that it can be used so that what now is 1000 lines of code becomes perhaps 100. Those 100 might take as long to write as the original 1000, but there are fewer failure points. The code can be more robust, if you stand on the shoulders of others.