confusion on the preprocessor instrcution

Discussion in 'C++' started by feverzsj, Jul 10, 2008.

  1. feverzsj

    feverzsj Guest

    as far as i know a header guard is used to avoid reduplicatively
    including same file

    // file xxx.h
    #ifndef XXX_HEADER
    #define XXX_HEADER

    //.....
    #endif

    so, is the defined macro "XXX_HEADER" only valid in current Compiling
    Units?
    While the compiler moves to other units, these macros defined in other
    units will be all abandoned? If not, files that need to include the
    same header in other unit will have problem.

    I've seached a lot ,but found few about such thing.
     
    feverzsj, Jul 10, 2008
    #1
    1. Advertisements

  2. feverzsj

    Ian Collins Guest

    feverzsj wrote:
    > as far as i know a header guard is used to avoid reduplicatively
    > including same file
    >
    > // file xxx.h
    > #ifndef XXX_HEADER
    > #define XXX_HEADER
    >
    > //.....
    > #endif
    >
    > so, is the defined macro "XXX_HEADER" only valid in current Compiling
    > Units?


    Yes.

    > While the compiler moves to other units, these macros defined in other
    > units will be all abandoned?


    Yes.

    --
    Ian Collins.
     
    Ian Collins, Jul 10, 2008
    #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. Chris P
    Replies:
    0
    Views:
    520
    Chris P
    Oct 28, 2003
  2. The Weiss Family

    VHDL Preprocessor

    The Weiss Family, Jul 14, 2004, in forum: VHDL
    Replies:
    2
    Views:
    3,368
    The Weiss Family
    Jul 14, 2004
  3. =?Utf-8?B?SSBhbSBTYW0=?=

    C# Preprocessor

    =?Utf-8?B?SSBhbSBTYW0=?=, Mar 13, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    1,742
    =?Utf-8?B?SSBhbSBTYW0=?=
    Mar 13, 2005
  4. Replies:
    0
    Views:
    2,912
  5. Glen
    Replies:
    65
    Views:
    1,872
  6. Taeyun Kim
    Replies:
    2
    Views:
    488
    Chris Uppal
    Oct 11, 2004
  7. Gibsonist
    Replies:
    0
    Views:
    489
    Gibsonist
    Jan 15, 2005
  8. Cronus
    Replies:
    1
    Views:
    921
    Paul Mensonides
    Jul 15, 2004
Loading...