I'm developing a NES emulator as a hobby, in my free time. I use C++ because is the language I use mostly, know mostly and like mostly.
But now that I made some advance into the project I realize I'm not using almost any specific features of C++, and could have done it in plain C and getting the same result. I don't use templates, operator overloading, polymorphism, inheritance. So what would you say? should I stay in C++ or rewrite it in C?
I won't do this to gain in performance, it could come as a side effect, but the idea is why should I use C++ if I don't need it?
The only features of C++ I'm using is classes to encapsulate data and methods, but that can be done as well with structs and functions, I'm using new and delete, but could as well use malloc and free, and I'm using inheritance just for callbacks, which could be achieved with pointers to functions.
Remember, it's a hobby project, I have no deadlines, so the overhead time and work that would require a re-write are not a problem, might be fun as well. So, the question is C or C++?
I use C++ because is the language I use mostly, know mostly and like mostly.
And that's the answer to your question. You should only switch languages mid project when there's a problem your current language can't solve.I don't use templates, operator overloading, polymorphism, inheritance.
It would be a lot more valuable to learn and use the concepts, than switching to C. Since this is a hobby project, why not use a few things you haven't used before? You could always start another project in C and learn the language, but for your current project it doesn't make sense to switch.std::shared_ptr
,std::unique_ptr
,boost::scoped_ptr
,std::vector
,std::deque
,std::map
, etc. For callback functions, look into the use of functors, and in C++11, you can also start using things like lambda functions.