quote:Original post by Etnu
C has a very slight speed advantage in the sense that your functions won''t be encapsulated within a class, which removes the accessor overhead.
This overhead is extremely minimal, and if you consider it a reason not to use C++, you have very poor criteria for language selection.
I know that you''re suggesting one discard the overhead, but I always found this ''overhead'' somewhat curious. Assuming non-virtual functions, I don''t see what overhead there is to speak of other than the implicit passing of the this pointer ... but the equivalent C function would probably take a struct pointer as an argument, so there''s no real difference here.
Assuming virtual functions, well, that''s a different kettle of fish ... but again, in order to write equivalent C code (presumably you do not use virtual functions if you do not need the functionality), you will have to implement the same functionality, by, say, a switch statement (slow) or by tables of function pointers (where again, you''re back to what C++ does for you) - again, I fail to see the significant difference.