What does this mean?

Discussion in 'C Programming' started by brettcclark@gmail.com, Dec 31, 2007.

  1. Guest

    This define is from the Vista SDK from propidl.h:

    #ifdef __cplusplus
    #define REFPROPVARIANT const PROPVARIANT &
    #else
    #define REFPROPVARIANT const PROPVARIANT * __MIDL_CONST
    #endif



    and again in propkeydef.h:

    #ifdef __cplusplus
    #define REFPROPERTYKEY const PROPERTYKEY &
    #else // !__cplusplus
    #define REFPROPERTYKEY const PROPERTYKEY * __MIDL_CONST
    #endif // __cplusplus


    OK, so I know what PROPVARIANT and PROPERTYKEY are, but I'm afraid
    that I don't understand what REFPROPVARIANT and REFPROPERTYKEY refers
    to.
    What exactly is being defined? How does REFPROPVARIANT and
    REFPROPERTYKEY relate to the original PROPVARIANT and PROPERTYKEY,
    respectively. I've not seen this same syntax before.

    Thanks!
    Brett
    , Dec 31, 2007
    #1
    1. Advertising

  2. On Mon, 31 Dec 2007 13:18:38 -0800, brettcclark wrote:
    > This define is from the Vista SDK from propidl.h:
    >
    > #define REFPROPVARIANT const PROPVARIANT * __MIDL_CONST
    >
    > OK, so I know what PROPVARIANT and PROPERTYKEY are, but I'm afraid that
    > I don't understand what REFPROPVARIANT and REFPROPERTYKEY refers to.
    > What exactly is being defined?


    REFPROPVARIANT is being defined. Whenever the preprocessor sees
    REFPROPVARIANT after that #define, it replaces it with const PROPVARIANT
    * __MIDL_CONST. That's all that #define does. It works the same way for
    REFPROPERTYKEY. It's a simple word replacement, without regarding context.

    I have no idea what const PROPVARIANT * __MIDL_CONST is supposed to mean,
    but you say you already know, so you should be able to figure out the
    rest once you understand how #define works.
    Harald van Dijk, Dec 31, 2007
    #2
    1. Advertising

  3. Guest

    On Dec 31, 4:29 pm, Harald van D©¦k <> wrote:
    > On Mon, 31 Dec 2007 13:18:38 -0800, brettcclark wrote:
    > > This define is from the Vista SDK from propidl.h:

    >
    > > #define REFPROPVARIANT const PROPVARIANT * __MIDL_CONST

    >
    > > OK, so I know what PROPVARIANT and PROPERTYKEY are, but I'm afraid that
    > > I don't understand what REFPROPVARIANT and REFPROPERTYKEY refers to.
    > > What exactly is being defined?

    >
    > REFPROPVARIANT is being defined. Whenever the preprocessor sees
    > REFPROPVARIANT after that #define, it replaces it with const PROPVARIANT
    > * __MIDL_CONST. That's all that #define does. It works the same way for
    > REFPROPERTYKEY. It's a simple word replacement, without regarding context.


    Right, so what does this mean then?

    const PROPVARIANT * __MIDL_CONST


    > I have no idea what const PROPVARIANT * __MIDL_CONST is supposed to mean,
    > but you say you already know, so you should be able to figure out the
    > rest once you understand how #define works.


    Ahh, I understand what the structure PROPVARIANT is, but, like you, I
    have
    no idea what the little asterisk is for... that was the question. I
    understand
    what define does, but the weird const PROPVARIANT * __MIDLE_CONST
    threw me
    for a loop.

    Thank you!
    , Dec 31, 2007
    #3
  4. On Mon, 31 Dec 2007 13:34:07 -0800, brettcclark wrote:
    > Right, so what does this mean then?
    >
    > const PROPVARIANT * __MIDL_CONST
    >
    >> I have no idea what const PROPVARIANT * __MIDL_CONST is supposed to
    >> mean, but you say you already know, so you should be able to figure out
    >> the rest once you understand how #define works.

    >
    > Ahh, I understand what the structure PROPVARIANT is, but, like you, I
    > have
    > no idea what the little asterisk is for... that was the question.


    const PROPVARIANT * simply means "pointer to read-only PROPVARIANT".
    Whether you're learning C or C++, your textbook or tutorial should cover
    pointers. It's __MIDL_CONST that could be pretty much anything, possibly
    a compiler-specific directive, possibly another macro, possibly something
    completely different.
    Harald van Dijk, Dec 31, 2007
    #4
  5. On 1月1æ—¥, 上åˆ5æ—¶54分, Harald van Dijk <> wrote:
    > On Mon, 31 Dec 2007 13:34:07 -0800, brettcclark wrote:
    > > Right, so what does this mean then?

    >
    > > const PROPVARIANT * __MIDL_CONST

    >
    > >> I have no idea what const PROPVARIANT * __MIDL_CONST is supposed to
    > >> mean, but you say you already know, so you should be able to figure out
    > >> the rest once you understand how #define works.

    >
    > > Ahh, I understand what the structure PROPVARIANT is, but, like you, I
    > > have
    > > no idea what the little asterisk is for... that was the question.

    >
    > const PROPVARIANT * simply means "pointer to read-only PROPVARIANT".
    > Whether you're learning C or C++, your textbook or tutorial should cover
    > pointers. It's __MIDL_CONST that could be pretty much anything, possibly
    > a compiler-specific directive, possibly another macro, possibly something
    > completely different.


    everyone's answer is good.I learn a lot,thanks.
    ¡ÚÒàÁµ¡ÛÃ÷ÖÇ, Jan 1, 2008
    #5
  6. Ron Natalie Guest

    wrote:

    > OK, so I know what PROPVARIANT and PROPERTYKEY are, but I'm afraid
    > that I don't understand what REFPROPVARIANT and REFPROPERTYKEY refers
    > to.
    > What exactly is being defined? How does REFPROPVARIANT and
    > REFPROPERTYKEY relate to the original PROPVARIANT and PROPERTYKEY,
    > respectively. I've not seen this same syntax before.
    >

    It means that in the twenty years Microsoft has been writing C and
    C++ operating system interfaces they still haven't learned from their
    past mistakes. For example a typedef here would sure be a better
    idea.

    Of course if you don't mind stepping in all the preprocessor doodoo
    that they gratuitously insert in your translation stream, I guess
    it's ok.
    Ron Natalie, Jan 1, 2008
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Pratip Mukherjee

    Help: what does this VHDL code mean?

    Pratip Mukherjee, Jun 22, 2005, in forum: VHDL
    Replies:
    16
    Views:
    1,257
    Kim Enkovaara
    Jun 27, 2005
  2. methi
    Replies:
    1
    Views:
    821
    info_
    Jun 23, 2005
  3. Li Ma
    Replies:
    1
    Views:
    2,262
    Roedy Green
    Mar 9, 2009
  4. Rahul
    Replies:
    4
    Views:
    546
    Robert Kern
    Apr 7, 2009
  5. C Barrington-Leigh
    Replies:
    1
    Views:
    1,177
    Tim Leslie
    Sep 10, 2010
Loading...

Share This Page