Re: Interfaces and C++ references (off-topic)
- From: "Igor Tandetnik" <itandetnik@xxxxxxxx>
- Date: Sun, 18 Dec 2005 11:05:18 -0500
"Goran Pusic" <goran_pusic@xxxxxxxxx> wrote in message
news:Oe9fWr5AGHA.2512@xxxxxxxxxxxxxxxxxxxx
> When in the "client code", that is, when not interfacing with COM
> calls, what do you think about passing COM interfaces by reference
> (as done in C++)?
I think you are going to greatly confuse every single programmer unlucky
enough to have to maintain your code - or even yourself, a few months
down the road - for no apparent gain.
> I know this works. I prefer it to pointers for the usual reasons we
> prefer references to pointers in C++. But, I wanted to know public
> opinion. Do you do it, or do frown upon it, and if so, why? Is there
> some COM etiquette regarding this...?
It's just that every COM programmer uses interface pointers, everywhere.
There's no strictly technical reason for this. However, it's rare that
you have long stretches of code using a single interface pointer without
having to interact with any other interfaces or COM API functions. And
when you do need to interact, it's an additional mental burden to have
to keep track of all the extra *'s and &'s .
Personally, I don't see how using references simplifies anything - quite
the opposite appears to be the case.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
.
- References:
- Interfaces and C++ references (off-topic)
- From: Goran Pusic
- Interfaces and C++ references (off-topic)
- Prev by Date: Interfaces and C++ references (off-topic)
- Next by Date: Re: Creating events in VC++ / ATL, receiving in VB
- Previous by thread: Interfaces and C++ references (off-topic)
- Index(es):
Relevant Pages
|