Beginner's question

Discussion in 'C Programming' started by Wong, Jan 11, 2005.

  1. Wong

    Wong Guest

    Hi gurus,

    This macro does not look like a common one. Is this a function ?

    #define Uint16(value) Uint8(value) , Uint8(value << 1)

    Thanks in advance.
     
    Wong, Jan 11, 2005
    #1
    1. Advertising

  2. Wong

    dandelion Guest

    "Wong" <> wrote in message
    news:...
    > Hi gurus,
    >
    > This macro does not look like a common one. Is this a function ?
    >
    > #define Uint16(value) Uint8(value) , Uint8(value << 1)


    Nope. It's a macro. Anything which is '#defined' is.
     
    dandelion, Jan 11, 2005
    #2
    1. Advertising

  3. Wong

    Richard Bos Guest

    (Wong) wrote:

    > This macro does not look like a common one. Is this a function ?
    >
    > #define Uint16(value) Uint8(value) , Uint8(value << 1)


    No, it's a function-like macro. It takes one parameter, and expands to
    the text behind it with "value" replaced by that parameter. For example:

    a=Uint16(24);

    is expanded to

    a=Uint8(24) , Uint8(24 << 1);

    in which both Uint8's are probably macros as well, so they would now be
    expanded, too.

    This does not look like a very useful macro to me, but it is a macro all
    the same.

    Richard
     
    Richard Bos, Jan 11, 2005
    #3
  4. Wong

    Flash Gordon Guest

    dandelion wrote:
    > "Wong" <> wrote in message
    > news:...
    >
    >>Hi gurus,
    >>
    >> This macro does not look like a common one. Is this a function ?
    >>
    >> #define Uint16(value) Uint8(value) , Uint8(value << 1)

    >
    > Nope. It's a macro. Anything which is '#defined' is.


    It looks to me like it is also probably wrong, as well as being bad
    style for not being spelled in upper case.
    --
    Flash Gordon
    Living in interesting times.
    Although my email address says spam, it is real and I read it.
     
    Flash Gordon, Jan 11, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jerker Hammarberg

    Beginner question: What trigs processes

    Jerker Hammarberg, Jul 17, 2003, in forum: VHDL
    Replies:
    16
    Views:
    1,655
    Mike Treseler
    Jul 22, 2003
  2. smu
    Replies:
    3
    Views:
    2,666
    shobhit24
    Jun 28, 2006
  3. =?Utf-8?B?S3VydCBTY2hyb2VkZXI=?=

    No Class at ALL!!! beginner/beginner question

    =?Utf-8?B?S3VydCBTY2hyb2VkZXI=?=, Feb 2, 2005, in forum: ASP .Net
    Replies:
    7
    Views:
    657
    =?Utf-8?B?S3VydCBTY2hyb2VkZXI=?=
    Feb 3, 2005
  4. Rensjuh
    Replies:
    7
    Views:
    1,046
    Mabden
    Sep 2, 2004
  5. william nelson

    Beginner's Beginner

    william nelson, Apr 11, 2011, in forum: Ruby
    Replies:
    7
    Views:
    262
    7stud --
    Apr 12, 2011
Loading...

Share This Page