C++ – How to keep in mind when porting from C to C++


What should I keep in mind when converting my projects from C to C++? Is there any reason to use C at all? The only thing in my mind now is to make sure it's friendly to DLLs so I can create a C interface if I need it.

Note: I know C++ just fine. Templates, partial specialization, why multiple inheritance is bad (I've only seen one proper use for it), etc. I mostly want to know why I would use C over C++. DLLs and script language bindings is one reason. So I just need to keep in mind I should have a C interface for certain things. Is there anything else?

Best Solution

At the risk of being obvious, I'd say the main thing to keep in mind is not to fix anything that isn't broken.

If you have a working C library, and want it to have a more "C++ ish" interface, then wrapping it in classes might be smarter than converting it. Certainly this satisifies the requirement to provide a DLL-friendly C interface: keep the one you've already got.