At one point I started a thread about how hard it is to convert 2003 Managed
C++ code to 2005 /clr C++ code, and said it was too hard. Well, now that
I've been doing it for a while, it isn't really that bad. You have to know a
few rules, and then just allow the compiler to tell you what's wrong.
I run the compiler, and then look at first error it reports. Correct, rinse,
lather, repeat. Usually errors can be corrected in one of the following
ways:
(*) change '*' to '^'
(*) change '__gc' to 'ref'
(*) remove __ from directives (e.g., __delegate => delegate)
(*) change new to gcnew
Arrays are the 'hard' one. change things of the form:
myClass my_class_array[] ;
my_class_array = new myClass[count];
to:
array<myClass>^ my_class_array ;
my_class_array = gcnew array<myClass>(count) ;
There are other changes, but these will get you through most conversions...
:)
[==P==]
Tom Serface - 16 Nov 2005 18:23 GMT
I think most people will kind of grow into the conversion (that's why they
put the switch to allow you to leave it the old way). Still, as you say,
when you really think about it the conversion is not rocket science. Thanks
for posting these steps. I think these may help others see that it's not
such a big leap to take even though initially they got like a gazillion
warning or error messages.
Tom
> At one point I started a thread about how hard it is to convert 2003
> Managed C++ code to 2005 /clr C++ code, and said it was too hard. Well,
[quoted text clipped - 25 lines]
>
> [==P==]