texttransformer.jpg

Abstract

Delphi2Cpp has reliably translated a big Delphi project with more than 30 units and 80'000 lines of code to VisualC++. Libraries also were mapped one to one. Only few manual interventions were necessary to compile the C++ code with Visual studio 2010 newly. A masterpiece -- Delphi2Cpp has exceeded all my expectations by far. A competent and fast support and advice have convinced me too.

Tony Hürlimann
http://www.virtual-optima.com



Summary Report

I develop a special computer language (LPL) (see http://www.virual-optima.com) since more than 20 years and have implemented a compiler for this in Delphi. The code consists of more than 30 units and about 80'000 lines of code. The code uses the standard units: System.pas, SysUtils.pas and Windows.pas, but uses no class libraries of Delphi. Of course the code uses all possible constructs of the Delphi language, like nested procedures, procedure parameters, callback functionality, Delphi strings, instructions for conditional compiling, code initializations for units and much more. The complete code is available as an EXE program, (i.e. as a console compiler) or as DLL-Library. The LPL-Library particularly is used by a user interface program independent of it.

I have recently decided to translate the LPL compiler code to C++ for different reasons. For that, the translation program "Delphi2Cpp" has done an inestimable job. In an iterative process which has lasted just 2 months. the complete LPL compiler code was successfully ported to Visual C++ and compiled with Visual studio 2010. The extensive test cases, to test the LPL compiler, were carried out successfully. A 64 bit version of the compiler also could be generated immediately. I must say that I just had base knowledge in C++ only and the environment Visual studio 2010 also was strange for me.

The mentioned iterative process consisted on the one hand in a gradually improvement of Delphi2Cpp, so that the present version 1.5.0 automatically translates the complete LPL compiler code one to one. Only a few manual interventions still are necessary (these still could be automated too!), to compile the translated code directly with Visual C++.
On the other hand -- that's where I have invested most time in this iterative process -- some bugs -- or at least inconsistencies -- appeared in the Delphi source code, which were eliminated in Delphi constantly. I mention two examples (which, of course, are permissible in Delphi and don't lead to faults):

1) overflow at a string: In Delphi a string S starts at position 1 and ends with position length (S) and #0 is at the position length (S) +1. This position unintentionally was used sometimes as a "sentinel" when passing through a string: therefore S[length(S)+1] was accessed. This is permitted, however "unsightly" and logically actually a fault. In C++ such an access leads rightly to an exception: The string can be accessed in the area S[0] to S[length(S)-1] only, the position S[length(S)] isn't permitted.

2) Also unintentionally the upper index of a FOR loop was used for other purposes again within the loop. Therefore the following code was written):

     for i:=1 to n do begin
          ....
          n := .....  ;
          .....
     end;

This is permitted in Delphi (and generally in Pascal) since the upper index n is fixed at the beginning of the loop. In C++ such a construction leads to faults which are hard to find. (Delphi2Cpp even shall discover and eliminate this "fault" in a future version.) ( Remark of Detlef Meyer Eltz: this fault is eliminated from Delphi2Cpp 1.5.1 on )

These examples also show how subtle the translation from a language into a different one can be. However, overall these were small things. Strings -- which are really special in Delphi -- are translated reliably, as well 16 bit char strings like in Delphi 2009 as 8 bit strings like in Delphi 2007. For this only a switch has be set in Delphi2Cpp. The memory-manager also didn't lead to any problems.

Overall: Delphi2Cpp is a reliable and extremely helpful translator of Delphi to C++ code. One also can have translated partial code fragments in C++ fastly. This was an inestimable help for me as a C++ beginner -- but Delphi expert -- to write C++ code fastly.


-----

Translated from German by Detlef Meyer-Eltz


   deutsch Deutsch

 

 
Latest News
01/29/24
Aurora2Cpp: Delphi 7 translator [more...]

10/19/23
Delphi2Cpp 2.3: Conversion of DFM files [more...]



"Thanks for your great work, really appreciate the work you have done on zlib and compiling ... test case."


Mattewada, Udayabhaskar
Nokia India 02/01/2021




[from case study...]

"A masterpiece -- Delphi2Cpp has exceeded all my expectations by far."


Tony Hürlimann
virtual-optima 08/20/2011



"First off, I have to say WOW! Delphi2Cpp is doing a *fantastic* job!"


Daniel Flower
linkrealms 01/15/2011


 
This website is generated from plain text with [Minimal Website ]

Minimal Website
Minimal Website is made with TextTransformer

TextTransformer
TextTransformer is made with Borland CBuilder

  borland