Re: Interfaces and C++ references (off-topic)



"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


.



Relevant Pages

  • Re: various objects in my VB6 project - Calling IUnknown
    ... >> It encapsulates the act of the object clearing up it's references before ... Private mcSegLensAs TextBox ... extensively, with a variety of small interfaces, and pass-through functions ... A ref to the default interface would be "server-side". ...
    (microsoft.public.vb.general.discussion)
  • Re: The difference between Reference and Component?
    ... My project is using dll which is listed under References. ... Any COM component can provide implementation for multiple COM Interfaces. ... Any component can also supply multiple controls, ... In general when VB loads the References list it merely reads the Registry ...
    (microsoft.public.vb.general.discussion)
  • Re: IDispatch definition in C#
    ... it implies that I store all standard COM interface ... Second, since I can store references to .NET interfaces, this ... provider of a COM interface service from a COM to a non-COM service, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: delphi problem: with Base as Base.ClassType do
    ... > I have already evaluated interfaces slightly and it's easy to tell ... > delphi classess) is very risky. ... references or only interface references to any object. ... It's not longer possibly to explicitly destroy objects... ...
    (alt.comp.lang.borland-delphi)
  • Re: problem: Service, with COM based UI, and fast user switching...UI ends up on wrong user
    ... Microsoft MVP, MCSD ... >>> Services should never interact with the desktop for very good reasons, ... If a second user logs in, ... >> dozens of interfaces and potentially hundreds of methods. ...
    (microsoft.public.vc.atl)