Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Gaming > Development Programming Misc > Re: C++ Questio...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 9 Topic 905 of 1002
Post > Topic >>

Re: C++ Question: try-throw-catch

by ajk <foo@[EMAIL PROTECTED] > May 15, 2007 at 11:29 AM

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.
 




 9 Posts in Topic:
C++ Question: try-throw-catch
Michael Hathcock <lord  2007-05-14 20:49:21 
Re: C++ Question: try-throw-catch
ajk <foo@[EMAIL PROTEC  2007-05-15 11:29:37 
Re: C++ Question: try-throw-catch
Tom Plunket <gamedev@[  2007-05-24 16:18:56 
Re: C++ Question: try-throw-catch
"Brandon J. Van Ever  2007-06-25 05:03:21 
Re: C++ Question: try-throw-catch
Miss Elaine Eos <Misc@  2007-06-25 07:40:24 
Re: C++ Question: try-throw-catch
"Brandon J. Van Ever  2007-06-26 02:41:53 
Re: C++ Question: try-throw-catch
Miss Elaine Eos <Misc@  2007-06-25 19:55:06 
Re: C++ Question: try-throw-catch
"Brandon J. Van Ever  2007-06-26 03:20:14 
Re: C++ Question: try-throw-catch
ajk <ak@[EMAIL PROTECT  2007-06-27 00:14:47 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Jul 9 4:39:04 CDT 2008.