Open Source C++ to C translation?

Is there any such thing as an open source C++ to C translator? I know this is how it used to be done way back in the day, but is there any free software that does this currently?

Thanks

-Zorak
10 answers Last reply
More about open source translation
  1. Apparently llvm will do this. Have a look at this FAQ. Now the only question is why on earth would you want to do it!
  2. The short answer is : "JFTFOI"

    The long answer: I am helping to try and move C++ code from one embedded platform to a different platform that doesn't have C++ support but does have C support and that was one of the things I was asked to look into, but it looks like it'd be easier to do a full rewrite in C because the translation examples i've seen online look GOD AWFUL. Thanks for the quick response! :D

    -Zorak
  3. From the FAQ:
    Quote:
    However, this is a good way to add C++ support for a processor that does not otherwise have a C++ compiler.


    Is there much left without GCC support nowadays?
  4. Zorak - the short answer was the best one!
  5. haha thanks ijack. Actually I don't know whether or not there is g++ support for this board, but the guy I am working with really seems to want to work with the C IDE that came with the board. I guess I should look and see if there is a g++ version for it. I'll do that tomorrow when I get paid to do it ;)

    -Zorak
  6. Besides LLVM, google found

    http://en.wikipedia.org/wiki/Cfront

    C++ to C translator by EDG ( http://www.edg.com ? )

    http://www.comeaucomputing.com/

    If it was up to me I would translate manually and use gcc g++

    GL :)
  7. I actually talked with the guy I am working with about using cfront, but it said that it doesn't have support for c++ exceptions, and since I havent looked at the code yet, i don't know if that will be a deal breaker or not. Thanks for finding that other optoin for me though Linux_0. I didn't see that when i did my initial search! :)

    -Zorak
  8. Cfront was a commercial product and seems to have been discontinued. v1.0 and v3.0 are available at http://www.softwarepreservation.org/projects/c_plus_plus/index.html#cfront

    If your code is old enough ( 1980s and early 1990s ) Cfront may be able to handle some of the translation, if you need to translate modern C++ code then this is probably not the right tool.

    The EDG translator may be prohibitively expensive.

    The comeaucomputing compiler is $50 and may not have the functionality you need.

    These are worth researching but in the end you may have to use LLVM or translate the code manually and use gcc g++ or plan G.
  9. I looked into whether or not there was g++ support for the cpu we are working with, and I was unable to find anything (it is a Rabbit 4000). However, the C++ code that I have seen is really more like C code anyways so I think I get to port it by hand. Fun fun!

    -Zorak
  10. The rabbit 4000's Dynamic C is not compatible with the ANSI-C standard so any ANSI-C or C++ code you may have will not work. $source=http://en.wikipedia.org/wiki/Rabbit_Semiconductor

    You have to code or re-code it all from scratch.
Ask a new question

Read More

Open Source Software