新语法 [英] New syntax

查看:103
本文介绍了新语法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是C ++的新手,所以我可能会遗漏一些东西。但是没有使用新的

语法^而不是*用于指针和''gcnew''而不是''new''例如

使代码非常如果需要,不可移植到非托管C ++?


Rasika。


PS。是否可以使用非托管代码中的托管程序集?

I am new to C++ so I may be missing something. But doesn''t using the new
syntax ^ instead of * for pointers and ''gcnew'' instead of ''new'' for example
make the code very non-portable to unmanaged C++, if the need ever arises?

Rasika.

PS. Is it possible to use managed assemblies from unmanaged code?

推荐答案

" Rasika WIJAYARATNE" <太阳神*************** @ discussions.microsoft.com>写在

消息新闻:87 ********************************** @ microsof t.com ...
"Rasika WIJAYARATNE" <Ra***************@discussions.microsoft.com> wrote in
message news:87**********************************@microsof t.com...
我是C ++的新手,所以我可能会遗漏一些东西。但是没有使用新的
语法^而不是*用于指针而''gcnew''而不是''new'用于
示例
使代码非常不可移植到非托管C ++,如果需要的话?
I am new to C++ so I may be missing something. But doesn''t using the new
syntax ^ instead of * for pointers and ''gcnew'' instead of ''new'' for
example
make the code very non-portable to unmanaged C++, if the need ever arises?




是的。但这不是重点。标准C ++不提供

自动垃圾回收。新语法用于在托管堆上操作

垃圾收集对象。


问候,




Yes. But that is beside the point. Standard C++ does not provide for
automatic garbage collection. The new syntax is used for manipulating
grabage-collected objects on the managed heap.

Regards,
Will


" Rasika WIJAYARATNE" <太阳神*************** @ discussions.microsoft.com>写在

消息新闻:87 ********************************** @ microsof t.com ...
"Rasika WIJAYARATNE" <Ra***************@discussions.microsoft.com> wrote in
message news:87**********************************@microsof t.com...
我是C ++的新手,所以我可能会遗漏一些东西。但是没有使用新的
语法^而不是*用于指针而''gcnew''而不是''new'用于
示例
使代码非常不可移植到非托管C ++,如果需要的话?
I am new to C++ so I may be missing something. But doesn''t using the new
syntax ^ instead of * for pointers and ''gcnew'' instead of ''new'' for
example
make the code very non-portable to unmanaged C++, if the need ever arises?




是的。但这不是重点。标准C ++不提供

自动垃圾回收。新语法用于在托管堆上操作

垃圾收集对象。


问候,




Yes. But that is beside the point. Standard C++ does not provide for
automatic garbage collection. The new syntax is used for manipulating
grabage-collected objects on the managed heap.

Regards,
Will


Rasika WIJAYARATNE写道:
Rasika WIJAYARATNE wrote:
我是C ++的新手,所以我可能会遗漏一些东西。但是没有使用
新语法^而不是*用于指针而''gcnew''而不是''new''
例如,使代码对非托管C ++非常不可移植,如果
需要出现吗?


是的。

Rasika。

PS。是否可以使用非托管代码中的托管程序集?
I am new to C++ so I may be missing something. But doesn''t using the
new syntax ^ instead of * for pointers and ''gcnew'' instead of ''new''
for example make the code very non-portable to unmanaged C++, if the
need ever arises?
Yes.

Rasika.

PS. Is it possible to use managed assemblies from unmanaged code?




是的。如果主程序不受管理,您可以使用.NET托管API来承载您的非托管应用程序中的CLR和托管代码。如果可以管理主程序

,那么VC ++可以为你处理所有的互操作,你可以混合

并匹配托管/非托管代码,你认为合适。


-cd



Yes. If the main program is unmanaged, you can use the .NET hosting APIs to
host the CLR and managed code in your unmanaged app. If the main program
can be managed, then VC++ can handle all the interop for you and you can mix
and match managed/unmanaged code pretty much as you see fit.

-cd


这篇关于新语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆