What does this mean?

B

brettcclark

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
 
H

Harald van Dijk

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

brettcclark

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!
 
H

Harald van Dijk

Right, so what does this mean then?

const PROPVARIANT * __MIDL_CONST


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

¡ÚÒàÁµ¡ÛÃ÷ÖÇ

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

Ron Natalie

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top