|
well, you have to change your file names from .c to .cc/.cpp/.c++/.cxx/anything else your compiler takes. then you may need to include the headers required for c++ functions, and may need to change some of your existing includes if you are using the c++ namespace model. you may also find that you've forgotten to declare some std* functions, which is okay by c (although good compilers will give you a warning), but not c++. c also does not enforce type checking on function parameters (old c, anyway), so you may find that some of your functions complain about their arguments. some defined external variables may also need to use the "extern C" specifier. it is also generally considered bad form to mix allocations using "malloc" and "new".
generally, a well-written c program will 'port' with little to no problems. a poorly written one, relying on old quirks in the language and general poor programming, can be quite a challenge.
|