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. Advertisements

  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. Advertisements

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. =?Utf-8?B?QW5kcmV3IFdpZWQ=?=

    Macro Question

    =?Utf-8?B?QW5kcmV3IFdpZWQ=?=, May 20, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    389
    Carlos J. Quintero [MVP]
    May 21, 2004
  2. Dead RAM
    Replies:
    20
    Views:
    1,558
    John Harrison
    Jul 14, 2004
  3. D Senthil Kumar

    macro name from macro?

    D Senthil Kumar, Sep 20, 2003, in forum: C Programming
    Replies:
    1
    Views:
    827
    Jack Klein
    Sep 21, 2003
  4. John Blevin

    Macro question

    John Blevin, Oct 16, 2003, in forum: C Programming
    Replies:
    1
    Views:
    399
    Dave Thompson
    Oct 20, 2003
  5. Charlie Zender

    C-preprocessor macro question

    Charlie Zender, Dec 24, 2003, in forum: C Programming
    Replies:
    3
    Views:
    556
    Richard Bos
    Dec 24, 2003
  6. sounak

    to get macro name from macro value

    sounak, Nov 22, 2005, in forum: C Programming
    Replies:
    17
    Views:
    728
    Mark McIntyre
    Nov 22, 2005
  7. Patrick Kowalzick
    Replies:
    5
    Views:
    743
    Patrick Kowalzick
    Mar 14, 2006
  8. Mike Manilone

    macro inside macro

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