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

  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. 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. Chris P
    Replies:
    0
    Views:
    439
    Chris P
    Oct 28, 2003
  2. The Weiss Family

    VHDL Preprocessor

    The Weiss Family, Jul 14, 2004, in forum: VHDL
    Replies:
    2
    Views:
    3,211
    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,576
    =?Utf-8?B?SSBhbSBTYW0=?=
    Mar 13, 2005
  4. Replies:
    0
    Views:
    2,667
  5. Cronus
    Replies:
    1
    Views:
    658
    Paul Mensonides
    Jul 15, 2004
Loading...

Share This Page