Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #11054

Re: macro with the same name in translation unit

From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: macro with the same name in translation unit
Date 2011-09-28 09:22 -0700
Organization None to speak of
Message-ID <lnvcsczlfg.fsf@nuthaus.mib.org> (permalink)
References <j5vce0$4sa$1@speranza.aioe.org> <4E834036.4090605@verizon.net>

Show all headers | View raw


James Kuyper <jameskuyper@verizon.net> writes:
[...]
> The following two alternatives don't violate that constraint, and have
> behavior corresponding to the two "obvious ways" I mentioned above:
>
> Option 1:
> #ifdef DUMMY
> #undef DUMMY
> #endif
> #define DUMMY 200
>
> Option 2:
> #ifndef DUMMY
> #define DUMMY 200
> #endif

Option 3:

#undef DUMMY
#define DUMMY 200

#undef does nothing if the macro isn't currently defined (though I
suppose some compilers might issue a warning).

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

macro with the same name in translation unit "Mark" <mark_cruzNOTFORSPAM@hotmail.com> - 2011-09-28 10:53 -0400
  Re: macro with the same name in translation unit James Kuyper <jameskuyper@verizon.net> - 2011-09-28 11:41 -0400
    Re: macro with the same name in translation unit Keith Thompson <kst-u@mib.org> - 2011-09-28 09:22 -0700
      Re: macro with the same name in translation unit James Kuyper <jameskuyper@verizon.net> - 2011-09-28 13:16 -0400
        Re: macro with the same name in translation unit Keith Thompson <kst-u@mib.org> - 2011-09-28 13:42 -0700
          Re: macro with the same name in translation unit James Kuyper <jameskuyper@verizon.net> - 2011-09-28 17:18 -0400

csiph-web