I was just looking at some old-style MC++ to convert a sample into C++/CLI. I had to convert this sort of thing:
public __gc class PostCodeChecker
{
public:
virtual String* Check(String* code)
{
String* error = S"OK";
return error;
}
Boolean Test(String* code)
{
Boolean ret = false;
String* error = Check(code);
if (error->Equals(S"OK"))
{
ret = true;
}
return ret;
}
};
Into this sort of thing:
public ref class PostCodeChecker
{
public:
virtual String^ Check(String^ code)
{
String^ error = "OK";
return error;
}
Boolean Test(String^ code)
{
Boolean ret = false;
String^ error = Check(code);
if (error=="OK")
{
ret = true;
}
return ret;
}
};
This is pretty mechanical work and just the sort of thing you might like to hand off to a tool. The VC++ team has been working on one, but it hasn't been a top priority. Now they've decided to release it as-is to those who might have some use for it, rather than holding onto it until it's perfected:
To set expectations correctly, the tool was going to be a “help” rather than a complete solution and in the push to complete other projects the tool was never fully completed, tested or documented. We are happy to release the tool “as is” as a few initial tests with external users have shown that they received benefits from using the tool even if: 1) it does not provide complete translation between the two different syntaxes and 2) manual modify of the outputted source code is still required to complete the conversion. The tool does come with source code so that users who wish to modify or extend the functionality to better suit their code bases can. The tool is totally unsupported by Microsoft.
If you have some oldstyle Managed C++ to convert, why not see if it can help you? It's a 5 meg download.
Kate
ps: one of the side effects of the more readable nature of C++/CLI is that after the mechanical work was done I just had to do this:
Boolean Test(String^ code)
{
return Check(code)=="OK";
}