Interfaces and C++ references (off-topic)



Hi all!

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++)?

Example:

SomeFunc(SomeComServer& Server);

and then:

SomeComServer* pServer;
ObtainServer(&pServer);
SomeFunc(*pServer);
SomeOtherFunc(*pServer);
pServer->Release();

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...?


.



Relevant Pages

  • Re: pointer syntax
    ... > really passing a reference (which is like an old-school pointer, ... > a copy of the primitive's value and passing that. ... build them yourself with pointers. ... mean a var parameter, write a var parameter. ...
    (comp.lang.pascal.delphi.misc)
  • Re: programming concepts > specific languages
    ... > pointers if you are just doing java all along. ... Java has consistent, but non-intuitive, rules involving passing by ... value/passing by reference. ... A lot of beginning Java programmers don't ...
    (comp.programming)
  • Re: no pointer in Java => my problem
    ... >> the value you are passing is an adress and you can't change the ... When passing a reference, you don't get ... > code anyway, where there are no pointers or references, just bit ... can design applications using objects and still implement them in C. ...
    (comp.lang.java.programmer)
  • Re: pointers and array of pointers
    ... I often think of pointers as a VARIABLE that contains a reference ... Want you want to do in myswap is pass the ... You do this by passing ...
    (comp.lang.c)
  • Re: dont understand looping problem
    ... > passing pointers is still pass by value. ... by reference" -- that is, you pass an object by reference by passing a ... My goal in these books is not to clutter them up with overly precise ...
    (alt.comp.lang.learn.c-cpp)