Handling exceptions in C++ is a quite easy, but pretty imporant procedure. You go even go about creating your own class that would handle exceptions locally. The idea is that you define your set of functions that checks for certain conditions and throw exceptions if they are not met. Basic exception handling usage involves using the try and catch commands. Inside the try block, you insert the code that you want to check for exceptions, while inside catch is the actual exception handling procedure. This is an example, handling a division by zero exception :
Read the rest of this entry »
No Comments »
Threaded programming is a quite large programming topic on its own. However, little by little, we will get to know of pThreads better. For starters, we will be describing how to create a simple thread using pThreads. Doing so is pretty easy. We just need to use pthread_create() in order to create our new thread. Let’s take a look at the code needed to create a simple thread that just prints a Hello :
Read the rest of this entry »
No Comments »
The assert macro is a very nice utility for programmers. It may sound complicated, but it is just a small macro that exits the program, giving us some debugging information on where the assertion happened, if a certain condition gets evaluated to false. Therefore :
Read the rest of this entry »
No Comments »
Writing a small program every now and then is what most programmers do all the time. However, there are occasions when we need to create something bigger. Imagine that you wanted to create a small RPG game. When you are into this type of programming, you certainly undestand that this will take lots of hours to write and probably your code needs to be pretty well organized. The point is that you cannot just go about writing an RPG game without any previous preparation.
How to Code Large Programs Properly
Read the rest of this entry »
1 Comment »
C++ is all about making C programmers lives easier. Function overloading is one more C++ feature that presented a nice technique for writing better and more managed code.
Read the rest of this entry »
No Comments »
If you have been using Ruby on Rails to create your websites or web applications, i’m pretty sure that you are looking for a fast and easy way to drop your database and recreate it, as well as feed it with your fixtures data. This procedure is actually 4 different tasks, but using a simple trick, you can make it very easy for you.
Read the rest of this entry »
No Comments »