P
Peter Oliphant
I've been trying all morning to convert my 2003 project (managed) to 2005
(/clr since I have both managed and unmanaged code). I'm guessing I have
tens of thousands of lines of code to change. Did a lot of converting '__gc'
to 'ref', converting '*' to '^', converting 'new' to 'gcnew'. Of course this
can't be done with a blanket replace, as my code has both managed and
unmanaged segments. Thus I have to do them one-by-one. Also, things are
missing. Like Form no longer has a Bounds property anymore (or at least if I
try to use it I get an 'it doesn't exist' error, which is a line that
compiled just fine in 2003). I can't have private virtual function even
though they were fine in 2003 (ok, i can see why they have to be protected).
In short, it's kind of exasperating to have to deal with an upgrade that
isn't even remotely backwards compatible (not even with old syntax switched
on)...
But, even after willing to do all of these changes, I now think I should
stop, having run into the Graphics class.
Graphics methods such as DrawPolygon() apparently no longer compile. The
only versions given are the ones using old syntax format for the required
__gc Points[] array. No /clr compatible overload of this function is given
(at least not in the look-ahead pop-up that comes up for DrawPolygon). So
how does one now draw a Polygon with the Graphics class now?
It's looking more and more that if you started in 2003 one should
(unfortunately) stay in 2003. Starting a project in 2005 might be good, but
converting is extremely difficult and prone to lots of erros. And even the
conversion I did into an old syntax 2005 version now returns with an
exception error it didn't have in 2003.... : (
Why didn't MS write a conversion tool? Sure it probably couldn't do
everything, but it could do the most obvious stuff. Like:
(1) identify '__gc' stuff and 'ref' it (note this doesn't work as a blanket
edit replace since '__gc' is also used to define other stuff, like arrays)
(2) replace appropriate '*' with '^', replace appropriate 'new' with
'gcnew', replace the '__' words with the new syntax versions (e.g.,
'__delegate' with 'delegate')
(3) make appropriate private virtual methods protected
(4) change abstract classes to the new syntax
(5) redefine arrays with the new 'array' syntax
(6) identify old methods that no longer works and put in the new syntax
(e.g., replace MakePolygon() code lines with the new syntax, and do this
will all such methods which have changed format)
(7) etc.
I've seen compiler errors that say stuff like "you did X, use Y instead".
Why doesn't the compiler give an option to make those changes FOR YOU?
I think 2005 is way too different from 2003 to call it an 'upgrade'. It's
basically incompatible with 2003 if one decided to use Managed C++...
[==P==]
(/clr since I have both managed and unmanaged code). I'm guessing I have
tens of thousands of lines of code to change. Did a lot of converting '__gc'
to 'ref', converting '*' to '^', converting 'new' to 'gcnew'. Of course this
can't be done with a blanket replace, as my code has both managed and
unmanaged segments. Thus I have to do them one-by-one. Also, things are
missing. Like Form no longer has a Bounds property anymore (or at least if I
try to use it I get an 'it doesn't exist' error, which is a line that
compiled just fine in 2003). I can't have private virtual function even
though they were fine in 2003 (ok, i can see why they have to be protected).
In short, it's kind of exasperating to have to deal with an upgrade that
isn't even remotely backwards compatible (not even with old syntax switched
on)...
But, even after willing to do all of these changes, I now think I should
stop, having run into the Graphics class.
Graphics methods such as DrawPolygon() apparently no longer compile. The
only versions given are the ones using old syntax format for the required
__gc Points[] array. No /clr compatible overload of this function is given
(at least not in the look-ahead pop-up that comes up for DrawPolygon). So
how does one now draw a Polygon with the Graphics class now?
It's looking more and more that if you started in 2003 one should
(unfortunately) stay in 2003. Starting a project in 2005 might be good, but
converting is extremely difficult and prone to lots of erros. And even the
conversion I did into an old syntax 2005 version now returns with an
exception error it didn't have in 2003.... : (
Why didn't MS write a conversion tool? Sure it probably couldn't do
everything, but it could do the most obvious stuff. Like:
(1) identify '__gc' stuff and 'ref' it (note this doesn't work as a blanket
edit replace since '__gc' is also used to define other stuff, like arrays)
(2) replace appropriate '*' with '^', replace appropriate 'new' with
'gcnew', replace the '__' words with the new syntax versions (e.g.,
'__delegate' with 'delegate')
(3) make appropriate private virtual methods protected
(4) change abstract classes to the new syntax
(5) redefine arrays with the new 'array' syntax
(6) identify old methods that no longer works and put in the new syntax
(e.g., replace MakePolygon() code lines with the new syntax, and do this
will all such methods which have changed format)
(7) etc.
I've seen compiler errors that say stuff like "you did X, use Y instead".
Why doesn't the compiler give an option to make those changes FOR YOU?
I think 2005 is way too different from 2003 to call it an 'upgrade'. It's
basically incompatible with 2003 if one decided to use Managed C++...
[==P==]