Wednesday, December 15, 2004

Re: which is faster : C or C++?

So, if I want to write such code (if?... hell I DO have to write such code), which is a better option - C or C++? In this case, is it right to say that you could use all the good organisation and 'cleanliness' of using classes and get the same performance if you let go of virtual functions?

I guess you've answered your own question. It's clear that your most important criteria is performance. And since you're only debating on C vs C++, C is more "lightweight" and you should be able to grind out more instructions/cycles with it.

But again, you are the only one who knows enough about your project to make the decision. Generally, you'd need to consider a lot more than just performance when choosing languages. In your case, you're deciding between C and C++. C++ (as we've all agreed) has a lot more to offer over C. But at the same time, you loose certain advantages that C provides - one of them being performance (and again this can be argued forever).

Looking at your project, would OOP be helpful? Dyou think that having classes will help in organizing and designing your project in a "better" way than C with its separation of functions and data? Think about the bigger picture rather than debate about "malloc()" vs "new".

BTW, post some info about your project.

No comments: