Interpreting a macro

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Chris Saunders

    #1

    Interpreting a macro

    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,D3DDECL TYPE_UNUSED, 0,0,0}

    Could someone help?

    Regards
    Chris Saunders


  • pete

    #2
    Re: Interpreting a macro

    Chris Saunders wrote:[color=blue]
    >
    > 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,D3DDECL TYPE_UNUSED, 0,0,0}[/color]

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

    --
    pete

    Comment

    • Chris Saunders

      #3
      Re: Interpreting a macro

      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
      "pete" <pfiland@mindsp ring.com> wrote in message
      news:42F9D317.3 9D8@mindspring. com...[color=blue]
      > Chris Saunders wrote:[color=green]
      >>
      >> 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,D3DDECL TYPE_UNUSED, 0,0,0}[/color]
      >
      > My guess is that it is an initializer for an aggregate type.
      >
      > --
      > pete[/color]


      Comment

      • Antonio Contreras

        #4
        Re: Interpreting a macro

        Chris Saunders wrote:[color=blue]
        > 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
        > "pete" <pfiland@mindsp ring.com> wrote in message
        > news:42F9D317.3 9D8@mindspring. com...[color=green]
        > > Chris Saunders wrote:[color=darkred]
        > >>
        > >> 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,D3DDECL TYPE_UNUSED, 0,0,0}[/color]
        > >
        > > My guess is that it is an initializer for an aggregate type.
        > >
        > > --
        > > pete[/color][/color]

        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,D3DDECL TYPE_UNUSED, 0,0,0};

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

        HTH

        Comment

        Working...