By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,131 Members | 1,977 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,131 IT Pros & Developers. It's quick & easy.

What does this mean?

P: n/a
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 '07 #1
Share this Question
Share on Google+
5 Replies


P: n/a
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.
Dec 31 '07 #2

P: n/a
On Dec 31, 4:29 pm, Harald van Dk <true...@gmail.comwrote:
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 '07 #3

P: n/a
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.
Dec 31 '07 #4

P: n/a
On 1月1日, 上午5时54分, Harald vanDijk <true...@gmail.comwrote:
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 '08 #5

P: n/a
br*********@gmail.com 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.
Jan 2 '08 #6

This discussion thread is closed

Replies have been disabled for this discussion.