On Mon, 14 May 2007 20:49:21 GMT, Michael Hathcock
<lord_mykhal@[EMAIL PROTECTED]
> wrote:
>Hi, all.
>
>I am formerly a lurker here, but I have recently begun to get back into
>game programming after a 12 year break from the hobby. My prior
experience
>with game programming is almost limited to the C language (I've done
little
>programming with QBASIC, Libery BASIC for Windows, C++, and a few other
>obscure languages.)
>
>I have begun working on a role-playing game using C++ for Windows with
>DirectX sup****t (later adding sup****t for OpenGL.) As I design the game/
>engine on paper, I found myself wondering, "What are all the con's to
using
>the C++ try-throw-catch syntax for handling program errors?"
>
>In the early versions of C++, this system used by C++ was said to be
>horrible due to code-bloat and a performance hit (in terms of speed.) In
C
>errors are handled by using return values and countless return value
>checks.
>
>Since it has been some time since I have worked at programming, has the
C++
>syntax improved (less code-bloat, better performance) or will it be
better
>to use return values as is the system used in C? The engine that I am
>designing is currently using the try-throw-catch syntax and a custom
>exception class that I wrote. In the long run, will this syntax choke
the
>game engine or will the extra sup****t code C++ uses (the extra code to
>handle function calls, stack unwinding) to implement the syntax have
>minimal impact?
>
>- Michael Hathcock
it depends a bit how long time ago it was :)
anyway coming from similar background I.e. programmed for many years I
would recommend using try/catch. Sure there is a slight performance
hit so one should use it strategically but it makes the code clearer
and gives you more elegant possibilities to troubleshoot and error
recovery than the traditional return value checks.
nowadays I can't manage without try/catch, I have gotten so used to
them and in the programming environment that normally linger error
recovery is essential.
just my 2c/Anders.


|