Common C programming mistakes

Posted on Sun 27 September 2015 in blog

I've decided to compile a list of common programming mistakes when using C.

Random numbers

Q: Why is my program generating the same random numbers?
A: You're probably re-seeding the PRNG. You should call srand() just once, at the beginning of your program. From then on, just avoid concurrent accesses …

Continue reading

Installing Nemiver on Centos 7

Posted on Tue 30 December 2014 in blog

I recently heard about Nemiver, a standalone C/C++ debugger for GNOME, and wanted to give it a try.

My current Linux development box is running CentOS 7. While Nemiver packages exist for CentOS 6, the same cannot be said for CentOS 7. So I proceeded to build it from …

Continue reading

Gotta catch 'em all: Last-chance exception handling in .NET with WinForms

Posted on Thu 07 March 2013 in blog

Recently, I went through the exercise of hooking up a crash-reporting component to a large .NET application using Windows Forms. The goal, of course, is to catch all unhandled exceptions so they can be reported to the developer.

Throughout this post I'll be referring to this Program.cs:

The code …

Continue reading

goto: The Forbidden Fruit

Posted on Mon 25 February 2013 in blog

Nowdays, it's not hard to find tons of arguments against the use of goto in C (and C-like languages). Post anything to StackOverflow, about/including goto and you're almost guaranteed to get flamed.

XKCD comic: goto

Just like many good and useful things in our lives (pocketknives, guns, kegs, etc.) it only takes …

Continue reading