This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: a nifty feature for c preprocessor
- From: R A <ren_zokuken01 at hotmail dot com>
- To: <dewar at adacore dot com>
- Cc: <gcc at gcc dot gnu dot org>
- Date: Sun, 1 Jan 2012 00:04:02 -0800
- Subject: RE: a nifty feature for c preprocessor
- References: <BLU163-W342C12D3ED2E4138C6E37383AE0@phx.gbl>,<BLU163-W112D62C836C94E7A8E14BE83AE0@phx.gbl>,<BLU163-W101189B8A57201E7156C4B83AC0@phx.gbl>,<BLU163-W25C240E42C4F005C6EC8D483AC0@phx.gbl>,<4EFAE808.2020300@westcontrol.com>,<BLU163-W303D03E552FD7FE2F570BE83AC0@phx.gbl>,<4EFB9A8E.5050305@hesbynett.no>,<BLU163-W5AFB44552B05762B858C183AC0@phx.gbl>,<4EFC39E0.1060307@westcontrol.com>,<BLU163-W33EF3A335E22C77A2F06F883AD0@phx.gbl>,<20111229213714.3BFED33C83@vlsi1.gnat.com>,<BLU163-W10EEE0C95722F5A6ED284083AD0@phx.gbl>,<20111229231852.16ABB33C83@vlsi1.gnat.com> <BLU163-W631C380362A632A3AD381C83930@phx.gbl>,<4EFFF238.6020404@adacore.com>
i don't know if you're trying to be funny...
but what's between the definition of N1 and the undef of A may be a very complex. it's just simplified for demonstration.
----------------------------------------
> Date: Sun, 1 Jan 2012 00:42:16 -0500
> From: dewar@adacore.com
> To: ren_zokuken01@hotmail.com
> CC: gcc@gcc.gnu.org
> Subject: Re: a nifty feature for c preprocessor
>
> On 12/31/2011 4:44 AM, R A wrote:
> >
> > alright, here's another example why eval is a good idea:
> >
> > #define A 17
> > #define B 153
> > #define N1 ((A + B)/2) /* intended was (17 + 153)/2 */
> >
> > #undef A
> > #define A 230
> > #define N2 ((A + B)/2) /* intended was (230 + 153)/2 */
>
> Bad example, this is a misuse of the preprocessor in any case!