vince@complex.elte.hu wrote:
hi,
Is there some efficient converter from c++ to C language?
o.
It used to be the case that every C++ compiler was just a front-end parsing tool to generate C code for the actual compiler. My first guess would be to look at your compiler and check for a switch which stores the intermediate C code! Best regards John
On 2/8/06, vince@complex.elte.hu <vince@complex.elte.hu> wrote:
hi,
Is there some efficient converter from c++ to C language?
I wouldn't say there is none, but there are compilers that generate C code before translating it into assembly instructions (EDG's C++ front end) is a perfect example (see http://www.comeaucomputing.com/). The first experimental C++ compiler, called CFront, written by AT&T translated C++ code to C (see http://www.unipress.com/toolkit/), but g++, for example, does not do this. You may also want to take a look at LLVM (http://llvm.cs.uiuc.edu/) that emits C code. Most automatically generated code is not maintainable in most cases and bound tightly to the architecture, which effectively eliminates portability from your code. \Steve -- Steve Graegert <graegerts@gmail.com> Software Consultant {C/C++ && Java && .NET} Office: +49 9131 7123988 Mobile: +49 1520 9289212
Is there some efficient converter from c++ to C language? I won't reiterate the other answers, but why do you want to convert a C++
On Wednesday 08 February 2006 7:51 am, vince@complex.elte.hu wrote: program to C? Depending on the structure of your C++ code, converting it to C could very well make the code rather unreadable. -- Jerry Feldman <gaf@blu.org> Boston Linux and Unix user group http://www.blu.org PGP key id:C5061EA9 PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9
Weel..I have a problem reading C++ program and I thought that there might be some code to convert it to be readable in C. Its hopelees, isn't it? o. On Wed, 8 Feb 2006, Jerry Feldman wrote:
On Wednesday 08 February 2006 7:51 am, vince@complex.elte.hu wrote:
Is there some efficient converter from c++ to C language? I won't reiterate the other answers, but why do you want to convert a C++ program to C? Depending on the structure of your C++ code, converting it to C could very well make the code rather unreadable.
-- Jerry Feldman <gaf@blu.org> Boston Linux and Unix user group http://www.blu.org PGP key id:C5061EA9 PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9
-- Check the headers for your unsubscription address For additional commands send e-mail to suse-linux-e-help@suse.com Also check the archives at http://lists.suse.com Please read the FAQs: suse-linux-e-faq@suse.com
On 2/8/06, vince@complex.elte.hu <vince@complex.elte.hu> wrote:
Weel..I have a problem reading C++ program and I thought that there might be some code to convert it to be readable in C. Its hopelees, isn't it?
We can help reading it if you want to. \Steve -- Steve Graegert <graegerts@gmail.com> Software Consultant {C/C++ && Java && .NET} Office: +49 9131 7123988 Mobile: +49 1520 9289212
On Wednesday 08 February 2006 8:21 am, vince@complex.elte.hu wrote:
Weel..I have a problem reading C++ program and I thought that there might be some code to convert it to be readable in C. Its hopelees, isn't it? Not hopeless, but I doubt you will get something that is easily readable. The problem in translating C++ to C today is that C++ has evolved into a more complex language. Not only do you have classes with class functions and class variables, you have overloading, polymorphism, and a few other goodies that do not exist in C.
As Steve also mentioned, we can help reading, but I would suggest that you move the thread to the suse-programming-e list since most of the readers here are probably not interested in C or C++. -- Jerry Feldman <gaf@blu.org> Boston Linux and Unix user group http://www.blu.org PGP key id:C5061EA9 PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9
vince@complex.elte.hu wrote:
Weel..I have a problem reading C++ program and I thought that there might be some code to convert it to be readable in C. Its hopelees, isn't it?
If you're thinking of using the code as a library of functions, you might can create a C header file for the C++ functions you want and compile the C++ code with the addition of extern "C" in front of functions you want to call from C. That sometimes works. But why not discuss this on suse-programming-e ? -- JDL
Vince, On Wednesday 08 February 2006 05:21, vince@gawain.elte.hu wrote:
Weel..I have a problem reading C++ program and I thought that there might be some code to convert it to be readable in C. Its hopelees, isn't it?
o.
Unless the C++ code is exceptionally simple, you will certainly not find any translation of that code to C more comprehensible. C++ is not a black art. Lear a little about it and you'll be able to get the gist of what the code does. Randall Schulz
On Wed, 8 Feb 2006 06:35:30 -0800, Randall R Schulz wrote:
C++ is not a black art. Lear a little about it and you'll be able to get the gist of what the code does.
I doubt that a little will do, specially when you have heavily templated code or even template meta-programming. But I'm open for convincing arguments :) But let's move the discussion to suse-programming-e as Jerry suggested. Philipp
On Wednesday 08 February 2006 08:21, you wrote:
On Wed, 8 Feb 2006, Jerry Feldman wrote:
On Wednesday 08 February 2006 7:51 am, vince@complex.elte.hu wrote:
Is there some efficient converter from c++ to C language?
I won't reiterate the other answers, but why do you want to convert a C++ program to C? Depending on the structure of your C++ code, converting it to C could very well make the code rather unreadable.
Weel..I have a problem reading C++ program and I thought that there might be some code to convert it to be readable in C. Its hopelees, isn't it?
First, try the suse-programming-e list as that list has a higher population of people who will understand the subject and that list has less noise than the busy suse-linux-e list. Second, C++ has features that have no direct correlation or meaning in straight C. If you have a question about what some confusing C++ code is attempting to do you should be able to post reasonable code snippets on the suse-programming-e list and help will arrive. Thanks, Ken Jennings
participants (8)
-
Jerry Feldman
-
John
-
John D Lamb
-
Ken Jennings
-
Philipp Thomas
-
Randall R Schulz
-
Steve Graegert
-
vince@complex.elte.hu