问题描述
第二个问题是:我什么时候使用这两个?
The second question is: When do I use what of these two?
推荐答案
如果未指定,C++ 是非托管 C++,编译为机器码.在非托管 C++ 中,您必须手动管理内存分配.
When not specified, C++ is unmanaged C++, compiled to machine code. In unmanaged C++ you must manage memory allocation manually.
托管 C++ 是 Microsoft 发明的一种语言,可编译为由 .NET Framework 运行的字节码.它主要使用与 C++ 相同的语法(因此得名),但编译方式与 C# 或 VB.NET 相同;基本上只有语法变化,例如使用 '->' 指向对象的成员(而不是 C# 中的 '.'),使用 '::' 表示命名空间等
Managed C++ is a language invented by Microsoft, that compiles to bytecode run by the .NET Framework. It uses mostly the same syntax as C++ (hence the name) but is compiled in the same way as C# or VB.NET; basically only the syntax changes, e.g. using '->' to point to a member of an object (instead of '.' in C#), using '::' for namespaces, etc.
托管 C++ 旨在简化从经典 C++ 到 .NET Framework 的过渡.它不打算用于启动新项目(首选 C#).
Managed C++ was made to ease transition from classic C++ to the .NET Framework. It is not intended to be used to start new projects (C# is preferred).
这篇关于托管 C++ 和 C++ 之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!