Converting C++ code to C

Hello,

I want to convert C++ code (which has Inheritance, Templates, Namespace, virtual function etc.) to C Is there any good document, which describes the basic convertion techniques.
Good luck.

Either you'll have to completely redesign the code or you will have to invent inheritance/virtual mechanism in C.

There is no equivalent for templates in C.
Anybody who has studied the theories behind programming languages will tell you that "any" language can be converted to "any other" language. It's all a matter of designing equivalent algorithms.

But the important differences between "Object Oriented" C++ and "Procedure Oriented" C are in their paradigms. That is, when you think about your programming design (that's design, not code), OOP's work-flow, or data-flow, works across the grain from procedures. To make the differences even worse, OOP's Inheritance/Encapsulation/Polymorphism are really hard features to get straight with just procedures.

In other words: Don't do it! Don't convert!

So you have two choices:
1. Totally re-design (not convert) your system for C.
or
2. Learn C++/OOP. Convert yourself to C++.

I predict that both of these approaches will prove equally hard.
But good luck on your choice, and I hope your choice works out well for you.
Yeah...I'm definitely for choice 2 here...don't try reinventing C++...
Topic archived. No new replies allowed.