Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6926071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:52:14+00:00 2026-05-27T10:52:14+00:00

I have a bit of COM code that uses interface pointers. The original author

  • 0

I have a bit of COM code that uses interface pointers. The original author of the code implemented functions that return an interface pointer like this:

HRESULT Query ( IN BSTR sQuery, OUT IEnumWbemClassObject* &pEnumerator ); // (1)

instead of the traditional

HRESULT Query ( IN BSTR sQuery, OUT IEnumWbemClassObject** ppEnumerator ); // (2)

The function (1) is called like this:

hRes = Query ( sQuery, pEnumerator ); // (3)

which definitely looks wrong but it works fine. I’m not sure if I’m just picking up this line because the out parameter is not a pointer to the output variable or because there’s something wrong with this approach.

Is there an advantage to using a reference-to-pointer instead of a pointer-to-pointer for out parameters?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T10:52:15+00:00Added an answer on May 27, 2026 at 10:52 am

    The first example is that of a reference to a pointer, ie. a reference to a type IEnumWbemClassObject*:

    HRESULT Query ( IN BSTR sQuery, OUT IEnumWbemClassObject* &pEnumerator );
    

    Therefore if pEnumerator is declared as a IEnumWbemClassObject* (which I’m assuming it is), you don’t need to explicitly pass the address of pEnumerator to the function or dereference the variable inside the function in order to change where pEnumerator points (which would otherwise be required with an argument of IEnumWbemClassObject**).

    A reference to a pointer has the same behaviour as a reference to any other type, just think of the above example as being a “reference to a pointer” and not a “pointer to a reference.” There’s no such thing as a pointer to a reference.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a bit of HTML code that I would like to change based
I have a 32 bit COM component that is used mostly by ASP, we
i have bit of code that causes an underflow: var t1, t2, delta: DWORD:
I have a bit of code that basically reads an XML document using the
I have a bit of code that passes around a ton of objects and
I have some working code that uses IImgCtx to load images, but I can't
I have a page that uses a bit of jQuery and an effect called
So I have this bit of python code that runs through a delicious page
I have a 32 bit COM server (and the source code for it) The
I have a simple bit of code that outputs the stream from a google

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.