My recent work has lead me to port several programs that I'd previously developed in C into C#. In a previous post, I explained some of my preference for C, but work being work (or research).... After these efforts, I thought I'd expand upon some of my joys and sorrows experienced during this effort.
First, overall the process was surprisingly easy. Most code required little to no changes. Often, entire code bodies were copied between projects with a single find / replace: "." in place of "->".
Second, the minor changes were basically those within the object-based model. Fields of a struct become public (or private). And global functions need to be assigned to a class.
Third, some types and constructs do not have an easy conversion. While not difficult, it was nonetheless annoying to have to redo arrays as having run-time defined length. Or to change types to UInt32.
The final aspect to porting between languages is the run-time / OS / system interfaces that do change. So while the internals of the magical program box remain relatively constant. The externals of how it interacts with the system to take in / send out data change. Fortunately, for my porting tasks, this code was relatively modest. (One of the more difficult parts of this step is covered in Ray Tracing ... Part 2).
No comments:
Post a Comment