Posts Tagged error

C++ For C# Developers: Part 52 – Idioms and Best Practices

Tags: , , , , , , , ,

As a very large language used for a very wide range of purposes over many decades, C++ can be written in a lot of different ways. Today we’ll look at some of the norms for “modern” C++ to get a sense of how code is normally written.

Read the rest of this article »

6 Comments

C++ For C# Developers: Part 40 – Utilities Library

Tags: , , , , ,

Today we’ll continue to explore the C++ Standard Library by delving into its utility classes and functions. These extremely common tools provide us with basics like std::tuple whose C# equivalent is so essential it’s built right into the language.

Read the rest of this article »

4 Comments

The Virtue of Stopping

Tags: ,

What do you do when your code finds a bug? We write code to check for null references and out-of-bounds indexes all the time. What’s the proper way to respond when we find a problem? Today we’ll look at two options and see how they pan out.

Read the rest of this article »

10 Comments

Handling Internal Errors

Tags: , , ,

Some errors can be handled and some cannot. Nevertheless, it’s extremely common to see codebases chock-full of ineffective error handling for these unrecoverable issues. The result is a lot of extra code to write, maintain, and test that often serves to make debugging harder. Today’s article shows you how to make debugging internal errors so much easier by effectively writing code to handle them.

Read the rest of this article »

2 Comments

How to Use Runtime Asserts to Find Bugs

Tags: , , , ,

Runtime asserts, not the asserts in unit tests, are a valuable debugging tool for any game developer. Today’s article shows you what they are, how to use them, how not to use them, and how they work. Read on to learn more!

Read the rest of this article »

No Comments

Creating A Better Assert Function

Tags: , , ,

The assert function is found in many languages to provide a way for you to check for errors only in debug builds of your code. For release/production builds, the asserts are removed to make the compiled code smaller and remove all of the overhead of the error checking. Flash doesn’t come with such a feature built-in, but can we build one ourselves? Today’s article will try to do just that using nothing but Adobe’s modern AS3 compiler: ASC 2.0.

Read the rest of this article »

3 Comments

Custom ErrorEvents

Tags: , ,

Chances are you’ve been bitten by the ErrorEvent class at some point while programming AS3. It’s the asynchronous equivalent to throw an Error and it happens when, for example, a Loader‘s load fails. If you write any code that performs an asynchronous task, perhaps more file loading, you too may want a way to inform users of your class that the task has failed. Just like with Event, it’s nice to be able to add data on to the standard ErrorEvent class. How does this work? Let’s dig in and find out.

Read the rest of this article »

3 Comments

Finally An Article About The Finally Keyword

Tags: , , , , ,

Try as I might, I just couldn’t find any articles about AS3’s finally keyword. Sure I found Adobe’s documentation, but it seems no one is commenting any further about finally. So today I’ll tackle the performance of what seems to be a straightforward keyword. Could it possibly cause a slowdown? Read on to find out!

Read the rest of this article »

4 Comments

Typecasting: Part 3

Tags: , , , , , , , ,

Today’s article is a followup to an article (Cast Speed, itself a followup to Two Types of Casts) from September that continues to gather comments. Sharp-eyed reader fastas3 brought up a good point that warranted some further investigation into the topic. So today we’ll be taking yet-another look at typecasting in AS3 to try to unravel some of its strange mysteries.

Read the rest of this article »

10 Comments

The Size of Empty

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , ,

I was reminded about the flash.sampler API by Grant Skinner’s recent post about it. While only available in the debug player, it can still tell us some valuable information about what goes on in the release player. Today I’m using the getSize function to find out how much memory overhead various classes impose, even when they are empty.

Read the rest of this article »

15 Comments