Interpreting a macro

C

Chris Saunders

Hope this question is appropriate here.
I'm writing an interface to some C code for the language Eiffel.
I have come across this macro and am having difficuly interpreting
what it returns:

#define D3DDECL_END() {0xFF,0,D3DDECLTYPE_UNUSED, 0,0,0}

Could someone help?

Regards
Chris Saunders
 
P

pete

Chris said:
Hope this question is appropriate here.
I'm writing an interface to some C code for the language Eiffel.
I have come across this macro and am having difficuly interpreting
what it returns:

#define D3DDECL_END() {0xFF,0,D3DDECLTYPE_UNUSED, 0,0,0}

My guess is that it is an initializer for an aggregate type.
 
C

Chris Saunders

Yes it is supposed to initialize an element of an array.
What I'm trying to figure out is if it returns a pointer or
some other type.

Oh, and thanks for the reply.

Regards
Chris Saunders
 
A

Antonio Contreras

Chris said:
Yes it is supposed to initialize an element of an array.
What I'm trying to figure out is if it returns a pointer or
some other type.

Oh, and thanks for the reply.

Regards
Chris Saunders

In first place. Please, don't top-post, it makes your answer more
difficult to read. In your defense, at least you quoted the message you
were replying to.

Judging by what you say, it seems to me that you don't really
understand how macros work. A macro does not "return" a value, not in
the sense that a function returns a value.

Prior to the actual compilation, the preprocessor substitutes (expands)
all macros. In your case if you had something like :

char a[6] = D3DDECL_END();

the preprocessor will expand de macro and generate the code:

char a[6] = {0xFF,0,D3DDECLTYPE_UNUSED, 0,0,0};

Then D3DDECLTYPE_UNUSED is with all probability another macro that
needs to be expanded before the code is actually passed to the
compiler.

HTH
 

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

Similar Threads


Members online

No members online now.

Forum statistics

Threads
474,169
Messages
2,570,918
Members
47,458
Latest member
Chris#

Latest Threads

Top