且构网

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

C ++游戏编程 - 爱或不信任?

更新时间:2023-02-15 21:35:51

看看,大多数你听到的一切任何人说编程的效率是神奇的思维和迷信。智能指针确实有性能成本;特别是如果你在内部循环中做了很多花哨的指针操作,它可能会有所不同。

Look, most everything you hear anyone say about efficiency in programming is magical thinking and superstition. Smart pointers do have a performance cost; especially if you're doing a lot of fancy pointer manipulations in an inner loop, it could make a difference.

也许。

但是当人们说这样的事情时,通常是一个人很久以前告诉他,X是真的,没有什么,但直觉背后的结果。现在,单元格/多态性问题听起来似乎真实 - 我敢打赌,这是对第一个说的人。但我还没有验证它。

But when people say things like that, it's usually the result of someone who told them long ago that X was true, without anything but intuition behind it. Now, the Cell/polymorphism issue sounds plausible — and I bet it did to the first guy who said it. But I haven't verified it.

你会听到关于C ++对操作系统的相同的事情:它太慢,它做你想要的东西做得不错。

You'll hear the very same things said about C++ for operating systems: that it is too slow, that it does things you want to do well, badly.

无论如何,我们完全在C ++中构建OS / 400(从v3r6 forward),裸机开启,并得到一个代码库是快速,高效,小。它需要一些工作;特别是从裸机工作,有一些引导问题,使用放置新的,那种东西。

None the less we built OS/400 (from v3r6 forward) entirely in C++, bare-metal on up, and got a code base that was fast, efficient, and small. It took some work; especially working from bare metal, there are some bootstrapping issues, use of placement new, that kind of thing.

C ++可能是一个问题,只是因为它太大了:I 现在重新阅读Stroustrup的护腕,这是非常吓人。但我不认为有什么内在的,说你不能在游戏编程中有效地使用C ++。

C++ can be a problem just because it's too damn big: I'm rereading Stroustrup's wristbreaker right now, and it's pretty intimidating. But I don't think there's anything inherent that says you can't use C++ in an effective way in game programming.