Tech Support > Microsoft Windows > Development Resources > Can't figure this one out.
Can't figure this one out.
Posted by nap on April 25th, 2005


I have a define which I am using to define a GUID, like this.



#define CYPRESS_DEVICE_GUID {0x36FC9E60L, 0xC465, 0x11CF, {0x44, 0x45,
0x53, 0x54, 0x00, 0x00, 0x00, 0x00}}


This works FINE in some files but fails in others. I get an error : "
Syntax Error '{' where it is being used.

any ideas?





Posted by Lucian Wischik on April 25th, 2005


"nap" <gospam@yourself.com> wrote:
I dislike #define for precisely this reason -- because the compiler
provides no typechecking that you've used it in the correct way
everywhere. Instead I use this:

const CLSID CypressCLSID = {0x36FC9E60L, 0xC465, 0x11CF, 0x44, 0x45,
0x53, 0x54, 0x00, 0x00, 0x00, 0x00};

--
Lucian


Posted by nap on April 25th, 2005


Thank you. I will look into that.


"Lucian Wischik" <lu.nn@wischik.com> wrote in message
news:silq615dkvnt3c8slb5r3gd5rb8q7qhrjj@4ax.com...


Posted by Severian [MVP] on April 25th, 2005


On Mon, 25 Apr 2005 15:42:36 GMT, "nap" <gospam@yourself.com> wrote:

Because it is in the format of an initializer, this will only be
usable in a definitions, such as:

CLSID cypress = CYPRESS_DEVICE_GUID;

You wont be able to pass it to functions requiring a GUID or use it in
any other context.

--
Phillip Crews aka Severian
Microsoft MVP, Windows SDK
Posting email address is real, but please post replies on the newsgroup.

Posted by nap on April 26th, 2005



"Severian [MVP]" <severian@chlamydia-is-not-a-flower.com> wrote in message
news:uksq61d5qdque8tstsct3ffe9rh36e2g6d@4ax.com...

I'd have to pass a pointer to it?

Thanksagain.







Posted by Severian [MVP] on April 26th, 2005


On Tue, 26 Apr 2005 00:10:31 GMT, "nap" <gospam@yourself.com> wrote:

You can't pass a pointer to a #define!

You'll ned to, as Lucian mentioned, create an actual instance of the
GUID, as a variable, and pass a pointer to that.

--
Phillip Crews aka Severian
Microsoft MVP, Windows SDK
Posting email address is real, but please post replies on the newsgroup.

Posted by nap on April 26th, 2005



"Severian [MVP]" <severian@chlamydia-is-not-a-flower.com> wrote in message
news:ig3r61pa2kprtaubshle9sskda1ppto5oa@4ax.com...
Sorry.. I took your post to imply that I could not pass the CLSID to
anything else..
of course you can not pass a pointer to a #define.

Or at least it hasn't worked yet in my 25 years of programming.




Posted by Severian [MVP] on April 26th, 2005


On Tue, 26 Apr 2005 01:14:57 GMT, "nap" <gospam@yourself.com> wrote:

Sorry, I wasn't clear. When I said "you wont [sic] be able to pass it
to functions..., I was referring the the #defined GUID, not the
declared GUID.

My apologies.

--
Phillip Crews aka Severian
Microsoft MVP, Windows SDK
Posting email address is real, but please post replies on the newsgroup.

Posted by nap on April 26th, 2005



"Severian [MVP]" <severian@chlamydia-is-not-a-flower.com> wrote in message
news:1l6r611nsa3g7nd6kvikvdh3thdi2gglu7@4ax.com...

Absolutely no need to apologize. I sincerely appreciate your response.





Similar Posts