Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | James Kuyper <jameskuyper@verizon.net> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: macro with the same name in translation unit |
| Date | 2011-09-28 13:16 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <4E835689.8050308@verizon.net> (permalink) |
| References | <j5vce0$4sa$1@speranza.aioe.org> <4E834036.4090605@verizon.net> <lnvcsczlfg.fsf@nuthaus.mib.org> |
On 09/28/2011 12:22 PM, Keith Thompson wrote: > 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: This is more like Option 1a: > #undef DUMMY > #define DUMMY 200 > > #undef does nothing if the macro isn't currently defined (though I > suppose some compilers might issue a warning). I should have remembered that! I still have fond memories of pointing out the same issue to Nick Maclauren nearly two decades ago. It was one of the few times I ever successfully corrected him on any issue.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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