What does the following preprocessor directive do?

Discussion in 'C Programming' started by contactsakthi@gmail.com, Nov 28, 2007.

  1. Guest

    Hi All,

    What does the following pre-processor directive do?

    #define X {{0xff, 0xffff}}

    Thanks in advance
    , Nov 28, 2007
    #1
    1. Advertising

  2. wrote:
    > Hi All,
    >
    > What does the following pre-processor directive do?
    >
    > #define X {{0xff, 0xffff}}
    >
    > Thanks in advance


    From this line forth until the end of translation unit or '#undef X',
    every occurence of the indentifier X will be replaced with
    {{0xff, 0xffff}}.

    In other words, anywhere where you could have written {{0xff, 0xffff}}
    you may now write X instead and it will have exactly the same effect.

    For further reading, please refer to the pre-processor section of your C
    textbook.
    Philip Potter, Nov 28, 2007
    #2
    1. Advertising

  3. In article <fik88k$e63$>, Philip Potter <> wrote:
    > wrote:
    >> #define X {{0xff, 0xffff}}


    > From this line forth until the end of translation unit or '#undef X',
    >every occurence of the indentifier X will be replaced with
    >{{0xff, 0xffff}}.


    >In other words, anywhere where you could have written {{0xff, 0xffff}}
    >you may now write X instead and it will have exactly the same effect.


    Except in string or character literals, of course.
    --
    "Beware of bugs in the above code; I have only proved it correct,
    not tried it." -- Donald Knuth
    Walter Roberson, Nov 28, 2007
    #3
    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. Trying_Harder

    Preprocessor directive

    Trying_Harder, Oct 2, 2003, in forum: C Programming
    Replies:
    16
    Views:
    665
    Kevin Easton
    Oct 5, 2003
  2. Replies:
    3
    Views:
    513
    Default User
    Mar 13, 2007
  3. Replies:
    1
    Views:
    375
    Ian Collins
    Mar 13, 2007
  4. Replies:
    5
    Views:
    467
    Joe Greer
    Jan 8, 2008
  5. asit

    Preprocessor directive

    asit, Jan 13, 2008, in forum: C Programming
    Replies:
    8
    Views:
    372
    Kenneth Brody
    Jan 15, 2008
Loading...

Share This Page