C vs. C++

Hey, I’m programming a Vid Game engine right now, and I’ve come to a design point that’s just begging for me to use an inheritance hierarchy. I know that heavy OO stuff and adding tons of layers of abstraction will slow down my program, but I was wondering if anybody could be a little more specific. Are arrays always faster than classes/structs? Don’t compilers optimize for this kinda stuff? Does anybody have any benchmarks?

-Thanks to all who reply :sunglasses:

er… the perennial question, it seems. Incidnetially, this ISN"T the best place to ask this kind of question. Check out alt.programmers.flamewars.between.C.and.C++.and.god.knows.what.else

it is easy to write slow C++ programs, and it is easy to grungy C programs. It doesn’t require MUCH effort to write nice, clean, elegant not-much-slower-than-C programs, but it takes a freak of a lot of effort to write large nice, elegant C programs. POssibly, that is, and it depends on who you talk to.

if you’re jsut hacking code for yourself, in your spare time, and you doj’t realy care how elegant it is (because you’re not going to employ a team of programmers to maintain it well into the future when the year 10k bug becomes an issue), then you can probably get away with C.

But, like i say… everyone WILL have their own opinions. Some people hail OOP as the savior of all things programmable, other people will maintain that the imperative C style is Good Enough, but at the end of the day, the opengl forum is NOT for these kind of debates. +)