RE: [GD-General] Compile times
Brought to you by:
vexxed72
From: Kyle W. <ky...@ga...> - 2002-12-17 19:14:57
|
Mick West wrote: > When you speak of the determinism of code, I understand that as a > measure of the extent to which you can predict the behaviour of a piece > of code. For example "'delete p' will call the destructor of object *p" > vs "'delete p' might call the destructor of the object *p" This general problem -- hiding of potentially expensive operations -- is really a problem with C++ code in general, not just with smart pointers. After all, it's not immediately obvious whether a variable going out of scope will disappear off the stack or call an expensive destructor when a function exits. It's not obvious whether object destruction will free resources or recursively call other destructors or spin-lock waiting for another thread. And the C++ emphasis on interface over implementation makes it harder for users of a class to keep up with the cost of creating/deleting/using instances of that class. The uncertainty is, of course, the price we pay for the higher level of abstraction at which C++ allows us to operate. I like C++, and I like smart pointers, and I find them both quite useful for the applications on which I work. I'm working on complex games on PCs and newer consoles, though. If I were writing for the GBA, or PalmOS, or cell phone applications, I'd be a lot more likely to give up smart pointers and classes in favor of the tighter control of straight C. Kyle |