This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: a nifty feature for c preprocessor


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!
 		 	   		  


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]