K
K
KOS_MOS2013-12-10 19:13:32
C++ / C#
KOS_MOS, 2013-12-10 19:13:32

Are there translators of code from C to C++?

There is a large piece of C code that needs to be sorted out and ported to Python, the code must be in Python, the option to compile based on the code will not suit the library.
As far as I heard, C and C++ have compatibility, so, in theory, the readability of the code will not deteriorate after translation, but it will be easier for me to figure it out with C++.

Answer the question

In order to leave comments, you need to log in

5 answer(s)
V
Vit, 2013-12-10
@fornit1917

in theory, after translation, the readability of the code will not deteriorate

You are absolutely right. And in order to translate the code from c to c++, you just need to do nothing with it)).

A
AxisPod, 2013-12-10
@AxisPod

C to C++, how is it? OOP to add? Well, that certainly won't work. So don't even try to find it.

A
al_sh, 2013-12-25
@al_sh

2. C++ is a very complex language (if you take all its features)
3. C is a simple language
Smiled)) Developers of drivers and operating systems will like the 3rd point
And if, in essence, c and c++ code get along perfectly in the project. Another thing is if the task is to get rid of the procedural component of the project

T
tugo, 2013-12-10
@tugo

Please post this code if you can.
Theses:
1. C is a subset of the C++ language (roughly speaking)
2. C++ is a very complex language (if you take all its features)
3. C is a simple language
4. Python is a higher-level language than C. Not everything can be ported 1-in-1, depending on what is written.
Therefore, my recommendations are:
1. Start learning the C language to the extent that you understand what is happening in that piece of code.
2. After that, start learning Python.
Book on C: www.ozon.ru/context/detail/id/2480925

S
Sergey, 2013-12-10
@begemot_sun

You probably need a tool similar to translation: C++ -> LLVM -> Python. Maybe there is such a thing. People translate ASM into Javascript. Probably also possible here.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question