Converting to C++

After some on-and-off work on the engine, it has now matured to a state where graphics, physics and input “kind-of-work”. It is now actually possible to play a quite challenging one-on-one game in Hover Extreme, where the aim is to push each other over the edge of the playground.

What next? Since I have been quite lazy on the class documentation side, I started looking at doxygen. As it turned out, it was very difficult to make doxygen understand that my C structs and functions were actually classes and class methods (I guess people are not normally coding object oriented programs this way…).

This was the trigger that I needed to make the decision to convert the program from C to C++. So, I am currently in the process of converting the entire code base (11,000 lines of code at the time of writing) to C++. I am especially looking forward to gaining access to the following C++ technologies: exceptions, class inheritance and string handling. My only real concern right now is that the C++ classes might consume more memory than my current, fairly slim, C language counterparts (especially critical for my mesh and triangle classes).

Since the program is fully object oriented even in its C implementation, the conversion should be fairly simple. The nice thing about all of this is that I can make the conversion gradually. The old C code compiles fine with g++, along with the parts that have already been converted to C++.

Leave a Reply

You must be logged in to post a comment.