How many try blocks

Started by
6 comments, last by Sepiantum 12 years, 5 months ago
How many try blocks do you have in your program/project and what is the size of your program/project?
Advertisement

How many try blocks do you have in your program/project and what is the size of your program/project?


1.
5017 lines.

Though I must say this is rather a-typical, even for a project that's still in the prototyping phase.
I'm not sure how much this data means. Everything depends upon language and programming style. In Python, for example, use of try blocks is encouraged where as in C++ it must be done with much more caution.

The project I am working on probably uses about 5 try blocks per thousand lines of Python code. I can't think of any uses in our C++ code, but there might be some and some of our code is written more in the style of C than C++ (I am less familiar with that part of our project).
* Zero try blocks in millions of lines of C++ code.
* One __try block in the C++ unit-testing code.
* Probably dozens/hundreds of try blocks in the C# project...


What is this supposed to mean anyway? What are you hoping to discover from this straw poll?
As many as the program needs.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

I get it. This is one of those hidden camera shows.

My current C++ engine has 1 where the Flex/Bison parser is required to interact with std templates that throw exceptions on failure.
I don’t think you will get anything out of this poll.
For your own code, use them or don’t. In games, people tend not to, but it is still an option.
But you still must use them when working with outside libraries that throw exceptions.


L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

About 4 or 5, but that's due to interaction with external API's that throw exceptions for non fatal error conditions.
[size="2"]Currently working on an open world survival RPG - For info check out my Development blog:[size="2"] ByteWrangler
0 try blocks, 9000+ lines of code. The point is to always use a return type for functions that may fail and CHECK TO SEE IF IT FAILS. Then your code can handle it any way it wants to.
Follow and support my game engine (still in very basic development)? Link

This topic is closed to new replies.

Advertisement