Macro question

Discussion in 'C Programming' started by Ben Pfaff, Jul 11, 2003.

  1. Ben Pfaff

    Ben Pfaff Guest

    Alejandro Torras <> writes:

    > is correct a macro construction like these ones?
    >
    > #define DEBUG_FLAGS 0x84


    Fine so far.

    > [.. Some code below...]
    > #if DEBUG_LVL && 0x80


    1. What's DEBUG_LVL? If it is not defined, then it will be
    treated as 0, and the following code will not be included.

    2. 0x80 is always non-zero, so this would normally be equivalent
    to just "#if DEBUG_LVL".

    In conclusion, it's valid, but confusing.
    Ben Pfaff, Jul 11, 2003
    #1
    1. Advertising

  2. Hi,

    is correct a macro construction like these ones?

    #define DEBUG_FLAGS 0x84
    [.. Some code below...]
    #if DEBUG_LVL && 0x80
    [...]
    #endif


    And these (equivalent) ones too?

    #define DEBUG_FLAGS 0x84
    [.. Some code below...]
    #if (DEBUG_LVL % 0x80) == 0
    [...]
    #endif


    Thank you.

    --
    Saludos,
    Alejandro Torras.
    Alejandro Torras, Jul 11, 2003
    #2
    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. Dead RAM
    Replies:
    20
    Views:
    1,095
    John Harrison
    Jul 14, 2004
  2. D Senthil Kumar

    macro name from macro?

    D Senthil Kumar, Sep 20, 2003, in forum: C Programming
    Replies:
    1
    Views:
    566
    Jack Klein
    Sep 21, 2003
  3. sounak

    to get macro name from macro value

    sounak, Nov 22, 2005, in forum: C Programming
    Replies:
    17
    Views:
    488
    Mark McIntyre
    Nov 22, 2005
  4. Patrick Kowalzick
    Replies:
    5
    Views:
    459
    Patrick Kowalzick
    Mar 14, 2006
  5. Mike Manilone

    macro inside macro

    Mike Manilone, Oct 3, 2011, in forum: C Programming
    Replies:
    8
    Views:
    440
    Mike Manilone
    Oct 6, 2011
Loading...

Share This Page