473,406 Members | 2,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

__event?

PGP
Anybody here using __event? Could you please discuss any potential issues
with it other than portability?

Priyesh
Aug 30 '07 #1
6 1535

"PGP" <priyesh_do_not_replywrote in message
news:uh**************@TK2MSFTNGP02.phx.gbl...
Anybody here using __event? Could you please discuss any potential issues
with it other than portability?
Nope. People using C++ in the managed world are now using C++/CLI (new in
VC++ 2005) which no longer supports the __event keyword, instead using
"context-sensitive" keywords that are only recognized at certain locations.
Aug 30 '07 #2
PGP

"Ben Voigt [C++ MVP]" <rb*@nospam.nospamwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>
"PGP" <priyesh_do_not_replywrote in message
news:uh**************@TK2MSFTNGP02.phx.gbl...
>Anybody here using __event? Could you please discuss any potential issues
with it other than portability?

Nope. People using C++ in the managed world are now using C++/CLI (new in
VC++ 2005) which no longer supports the __event keyword, instead using
"context-sensitive" keywords that are only recognized at certain
locations.

I was wondering about the native C++ part of it. Would you rather look into
a third party library or would you consider using the __event, __hook
and __unhook? Overall, I did not find any good feedback on the __event
mechanism during my research, but I would defenitely want to use it
if it's here to stay. I have done some tests of my own and tried out
MSDN samples. It does exactly what I want it to do. Now I am
looking for some reassurance.

Priyesh
Aug 31 '07 #3

"PGP" <priyesh_do_not_replywrote in message
news:ug**************@TK2MSFTNGP02.phx.gbl...
>
"Ben Voigt [C++ MVP]" <rb*@nospam.nospamwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>>
"PGP" <priyesh_do_not_replywrote in message
news:uh**************@TK2MSFTNGP02.phx.gbl...
>>Anybody here using __event? Could you please discuss any potential
issues with it other than portability?

Nope. People using C++ in the managed world are now using C++/CLI (new
in VC++ 2005) which no longer supports the __event keyword, instead using
"context-sensitive" keywords that are only recognized at certain
locations.

I was wondering about the native C++ part of it. Would you rather look
into
You were in the C++/CLI newsgroup... microsoft.public.vc.language is focused
on native features.
a third party library or would you consider using the __event, __hook
and __unhook? Overall, I did not find any good feedback on the __event
mechanism during my research, but I would defenitely want to use it
if it's here to stay. I have done some tests of my own and tried out
MSDN samples. It does exactly what I want it to do. Now I am
looking for some reassurance.
Are you looking for COM compatibility? If you just want event handling in
within a C++ application, then pointer-to-member-function is 100% in the C++
standard and does what you want. In the rare case you need to support
multiple subscribers, then a std::vector or std::list of
pointer-to-member-function will get you there, again 100% standard and
portable. A template helper function can hide the details of iterating
through and calling all receivers. That will get even better in C++0x with
template support for arbitrary argument lists (not sure what the correct
name of the feature is).
>
Priyesh
Aug 31 '07 #4
On Fri, 31 Aug 2007 22:55:45 +0300, Ben Voigt [C++ MVP]
<rb*@nospam.nospamwrote:
[...]Are you looking for COM compatibility? If you just want event
handling in within a C++ application, then pointer-to-member-function is
100% in the C++ standard and does what you want. In the rare case you
need to support multiple subscribers, then a std::vector or std::list of
pointer-to-member-function will get you there, again 100% standard and
portable.
Or have a look at Boost.Signals (see
http://www.boost.org/doc/html/signals.html) which is
C++ standard-compatible library which should do what you want out of the
box.

Boris
Sep 2 '07 #5
PGP

"Ben Voigt [C++ MVP]" <rb*@nospam.nospamwrote in message
news:0D**********************************@microsof t.com...
>
"PGP" <priyesh_do_not_replywrote in message
news:ug**************@TK2MSFTNGP02.phx.gbl...
>>
"Ben Voigt [C++ MVP]" <rb*@nospam.nospamwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>>>
"PGP" <priyesh_do_not_replywrote in message
news:uh**************@TK2MSFTNGP02.phx.gbl...
Anybody here using __event? Could you please discuss any potential
issues with it other than portability?

Nope. People using C++ in the managed world are now using C++/CLI (new
in VC++ 2005) which no longer supports the __event keyword, instead
using "context-sensitive" keywords that are only recognized at certain
locations.

I was wondering about the native C++ part of it. Would you rather look
into

You were in the C++/CLI newsgroup... microsoft.public.vc.language is
focused on native features.
>a third party library or would you consider using the __event, __hook
and __unhook? Overall, I did not find any good feedback on the __event
mechanism during my research, but I would defenitely want to use it
if it's here to stay. I have done some tests of my own and tried out
MSDN samples. It does exactly what I want it to do. Now I am
looking for some reassurance.

Are you looking for COM compatibility? If you just want event handling in
within a C++ application, then pointer-to-member-function is 100% in the
C++ standard and does what you want. In the rare case you need to support
multiple subscribers, then a std::vector or std::list of
pointer-to-member-function will get you there, again 100% standard and
portable. A template helper function can hide the details of iterating
through and calling all receivers. That will get even better in C++0x
with template support for arbitrary argument lists (not sure what the
correct name of the feature is).
>>
Priyesh
Ben,
COM is not in the picture. I am also not worried about porting this code
outside MS compilers. Calling multiple subscribers is a needed feature.
__hook supports calling multiple subscribers and it's thread safe. Apart
from potential portability issues, it seems to me that __hook is a perfect
fit.
If i roll my own as you suggest, i am still left with the task of
synchronizing
access from multiple threads.
Priyesh
Sep 5 '07 #6
PGP

"Boris" <bo***@gtemail.netwrote in message
news:op***************@burk.mshome.net...
On Fri, 31 Aug 2007 22:55:45 +0300, Ben Voigt [C++ MVP]
<rb*@nospam.nospamwrote:
>[...]Are you looking for COM compatibility? If you just want event
handling in within a C++ application, then pointer-to-member-function is
100% in the C++ standard and does what you want. In the rare case you
need to support multiple subscribers, then a std::vector or std::list of
pointer-to-member-function will get you there, again 100% standard and
portable.

Or have a look at Boost.Signals (see
http://www.boost.org/doc/html/signals.html) which is C++
standard-compatible library which should do what you want out of the box.

Boris
Boris,

Thanks for the suggestion. Boost looks excellent. I have contemplated on
using
Boost multiple times before and havent yet. Although starting to use Boost
now
will be a good idea as there are other excellent features like regex that i
could
take advantage of, it is too much of a change to introduce at this point to
otherwise
stable code so i am a little worried.
Priyesh
Sep 5 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: JPRoot | last post by:
Hi I use the following syntax to have events inherited from base to child classes which works nicely (virtual and override keyword on events). But I am wondering if it is a "supported" way of using...
1
by: | last post by:
Serious bug discovered in VC .NET (2002) compiler. Example below should work if I understand the Microsoft documentation correctly. Hopfelly there is some compiler upgrade that fixes this bug?...
2
by: Michael Kennedy [UB] | last post by:
public __gc class CWADataManagerEvents { public: __event void CreateGauge(String * type, bool shared, String * name, GaugeCreateSettings * settings); __event void SetupGauge(unsigned short GID,...
5
by: Joe Thompson | last post by:
Hi, I am using VC++.Net 2003 with WinForms to write a serial port application. I downloaded the newest VC++ examples from MSDN and found a project called Using the COM Port. In it, there is a...
0
by: Edward Diener | last post by:
Scenario: base class in one assembly, derived class in another assembly, __event in base class, testing if event has any handlers in derived class with 'if (OnTestEvent) { //etc. }'. Result:...
1
by: | last post by:
I want to hook events handlers but need to test of any event handler is assigned or not. I need something like this: __event void OnEventHandler(Myfunc) .... if (OnEventHandler)...
0
by: Lord2702 | last post by:
Sun. Aug. 29, 2004 5:00 PM PT I have a user control class which defined as follows... public __gc class MyControl : public UserControl { //---- //-- other fields methods and properties....
0
by: Dave L | last post by:
I just upgraded from VS .NET 2002 to 2003. Everything built okay, but strange bugs started appearing. Apparently there is a bug in the managed C++ compiler in regards to handling of static...
1
by: Edward Diener | last post by:
I have a __gc class, let's call it ClassB, derived from ClassA, which has an __event, and eventually derived from System::ComponentModel::Component. This ClassB has no __event. I derived another...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.