Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this questionI got my hands on some well documented C++ code that's about 1KLOC. It would take me a significant amount of time to port 开发者_如何学Cthis line by line and debug the results, so I'm wondering if there are tools or ways to do it faster, and I have questions in case I have to do it fully manually.
Specific questions:
- Does C# also support overriding operators like
*
and+
? - What to do with the C++ memory management code like alloc() and free()?
- How to identify functions used from
<stdio.h>
,<conio.h>
and<math.h>
? - How to find replacements to such system functions?
- Does C# have any special/open source libraries that provide such functions?
No graphics libraries have been used, its purely command line based.
You might want to try this tool and see if that works out for you. There is a demo where you translate up to a 100 lines of code at a time:
http://tangiblesoftwaresolutions.com/Product_Details/CPlusPlus_to_CSharp_Converter_Details.html
Try it out and let us know. But it would prolly be more beneficial to port this yourself in c# so you can get a handle of the features that c# comes with.
You will need to do it manually, and 1KLOC isn't much.
However, you will need to learn C#.
To answer your questions:
- Yes
- Depending on what you're doing, probably
List<T>
- I don't know what you're asking
- Look in the .Net Framework class library on MSDN
- Yes
1 - C# also support operator overloading see : http://msdn.microsoft.com/en-us/library/aa288467(VS.71).aspx (it looks very much to c++ operator overriding)
2 - C# is garbage collected so you only need "new" instead of alloc. free is done by the garbage collector
3 - I have no idea , but when porting code you would have to find in standard c# library the equivalents
4 - In MSDN there is a lot of information.
5 - ( http://code2code.net/ ) ??? but better to do it at hand
More information on coding standards : http://msdn.microsoft.com/en-us/library/xzf533w0.aspx ie naming: http://msdn.microsoft.com/en-us/library/x2dbyw72.aspx
精彩评论