Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > What does this mean?

Reply
Thread Tools

What does this mean?

 
 
brettcclark@gmail.com
Guest
Posts: n/a
 
      12-31-2007
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
 
Reply With Quote
 
 
 
 
Harald van Dijk
Guest
Posts: n/a
 
      12-31-2007
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.
 
Reply With Quote
 
 
 
 
brettcclark@gmail.com
Guest
Posts: n/a
 
      12-31-2007
On Dec 31, 4:29 pm, Harald van Dk <true...@gmail.com> 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!
 
Reply With Quote
 
Harald van Dijk
Guest
Posts: n/a
 
      12-31-2007
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.
 
Reply With Quote
 
Guest
Posts: n/a
 
      01-01-2008
On 1月1日, 上午5时54分, Harald van Dijk <true...@gmail.com> 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.
 
Reply With Quote
 
Ron Natalie
Guest
Posts: n/a
 
      01-01-2008
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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
.NET 2.0 ASPx Page does not load, but HTM does prabhupr@hotmail.com ASP .Net 1 02-08-2006 12:57 PM
Button OnClick does not fire on first postback, but does on second Janet Collins ASP .Net 0 01-13-2006 10:08 PM
Does the 2.0 Framework come out when Visual Studio .NET 2005 does? needin4mation@gmail.com ASP .Net 3 10-07-2005 12:55 AM
CS0234 Global does not exist ... but it genuinely does Bill Johnson ASP .Net 0 07-08-2005 06:34 PM
Does no one else think microsoft does a poor job? =?Utf-8?B?SmVyZW15IEx1bmRncmVu?= Wireless Networking 2 11-20-2004 12:17 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57