为什么不推荐使用本机Visual C ++中的事件处理? [英] Why is event handling in native Visual C++ deprecated?

查看:104
本文介绍了为什么不推荐使用本机Visual C ++中的事件处理?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

http://msdn.microsoft.com/en-us/library /ee2k0a7d.aspx



本机C ++类($ b $的C ++类)也支持事件处理b不实现COM对象),但是
已弃用该支持
,并将在以后的
版本中删除该支持

任何人都知道为什么吗?找不到该语句的任何解释。

Anyone knows why? Couldn't find any explanation for this statement.

推荐答案


  1. 这完全是非标准的实际的
    用户可能很少。我的意思是即使在WinNT和Microsoft私有世界中,非标准狂人也喜欢。

  1. It's totally non-standard kludge that probably has very little actual users. And I mean non-stndard kludge even in WinNT and Microsoft-private world.

COM对于类似事件的机制具有更丰富的功能,并且还允许$ b $如今,b完全是多线程的代码

COM has much richer repertoire for event-like mechanisms and also allow fully multi-threaded code these days

这是致命的-该功能正在进行隐式锁定(可能是我们爷爷的想法 bsynchonized模板之前,并广泛安全地使用正常关键部分)。
使其比COM的单身公寓更加危险:等等,因为它可能给您带来死锁(也发生在Java的同步方法上-没什么特别的:-)

This one is lethal - that functionality is doing implicit locking (probably our grandpa's idea of "synchonized" before templates and widespread safe use of normal critical sections). That makes it more dangerous than COM's single apartment, ahem, thing :-) As in it can give you a deadlock out of nowhere (happened to Java's synchronized methods as well - nothing special :-)

这些天,每个人和他们的狗都知道如何使用普通的多线程以及至少具有智能指针的关键部分,因此,除了危险之外,这也无关紧要。

Everyone and their dogs know how to use normal multi-threading and at least critical sections with smart pointers these days, so besides being dangerous, that thing is also irrelevant.

这篇关于为什么不推荐使用本机Visual C ++中的事件处理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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