C/C++ to Delphi Converter

C/C++ to Delphi Converter

I just received my copy of "Clean Architecture" by Robert C. Martin (Uncle Bob). All of the examples are in C/C++ and it's very difficult for me to understand.

Does anyone know of a C/C++ to Delphi converter?

Comments

  1. With respect to Shlomo's offering, I would be happy to learn that it is a comprehensive solution, but that would make it unique. One of the difficulties is the existence of macros.

    Haven't used a C converter in years. There were two main ones, each of which had some serious problems, but happily not in the same areas.

    It only hurts for a little while. You will do well to begin learning the C++ syntax, and after a bit, it will not seem so very strange.

    ReplyDelete
  2. Thanks for the link shlomo however having eyeballed the project I doubt it'll be much help here. It seems only to support C, and only fairly simple conversions.

    Michael, perhaps you could ask specific questions about specific examples not understood and maybe we can help?

    (Though I've read some of Uncle Bob's other books I've not read this one, I'm almost tempted to get it now and convert the C++ examples to Delphi to help revitalise my ossified C++ and help address this kind of problem...)

    ReplyDelete
  3. A little more on the C pre-processor. If a macro expansion inserts another macro in the result, the pre-processor expands the result. This continues until no further expansion is possible. In consequence, it would be impossible to convert macros without including the full functionality of the C pre-processor in your converter. Add to this that macros in external files may need expansion, and the nastiness should be quite apparent.

    Bear in mind, too, that the early implementations of C++ were actually C with some very complex macros.

    In my limited experience of that side of life, the use of macros seems to be pervasive, but the use of macros which expand to macros is much less common.

    In actual C++ code, I have no idea how much the pre-processor is used. One may hope not at all.

    ReplyDelete
  4. Opinion: ORelly's "C in a nutshell" == "Everything you ever wanted to know about C tokenism but where afraid to ask"... I slowly read it again while waiting around for appointments, and actually re-learned a couple of useful tid bits.

    ReplyDelete
  5. Joe C. Hecht I see there is also "C++ in a Nutshell", by old Delphi hand Ray Lischner, who did "Delphi in a Nutshell" years ago. May be similarly useful.

    I note, however, that those "nutshells", the first at over 800 pages, and the second at over 700, seem rather large. Not faulting content, it's a comment on the title.

    ReplyDelete
  6. Bill Meyer I have them too. Lets hope I do not get the oppurtunity to read them (it would be a testimonial to waiting).

    ReplyDelete
  7. An automatic converter won't exist and even if it did it wouldn't help you. You'd be better learning enough C++ to understand the examples.

    ReplyDelete
  8. How hard can the code be in a book called Clean Architecture? (unless its a chapter about bad architecture)

    ReplyDelete
  9. I probably spend 20% of my time porting code both directions (at at one to and from PERL as well). Most of my "style" of code is automated, but general code? Nah, I port that by hand (mostly getting it to my style that can be automated). I once ran across an online service that did pretty well for some bits I threw it for fun, but honestly, at the end of the day, you have to put a lot trust in something like that (and I cannot blindly do that). Macros can be a little challenging at times, but the rest is pretty easy. Best to step back, look at what the code is supposed to do, and learn "just enough" to port it. It mostly boils down to some smart search and replace, a bit of rearrangement (and often a lot of pointers).

    ReplyDelete

Post a Comment