RE: a nifty feature for c preprocessor

2012-01-01 Thread R A
...@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

RE: a nifty feature for c preprocessor

2012-01-01 Thread Richard Kenner
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. It's not good programming practice to have a macro (in this case A) have two different values, with an #undef between then.

Re: a nifty feature for c preprocessor

2012-01-01 Thread David Brown
On 31/12/11 10:44, 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 */

Re: a nifty feature for c preprocessor

2012-01-01 Thread Ruben Safir
On 01/01/2012 12:42 AM, Robert Dewar wrote: 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

RE: a nifty feature for c preprocessor

2011-12-31 Thread R A
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 */ printf(%u %u, N1, N2);

Re: a nifty feature for c preprocessor

2011-12-31 Thread Robert Dewar
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 +

Re: a nifty feature for c preprocessor

2011-12-30 Thread Basile Starynkevitch
On Thu, 29 Dec 2011 13:12:19 -0800 Ian Lance Taylor i...@google.com wrote: Any gcc developer who feels that this proposal is a good idea, please chime in here. I personally do not feel it is worth the effort. It's easy to use a more powerful macro processor, such as m4, to generate your C

Re: a nifty feature for c preprocessor

2011-12-29 Thread David Brown
On 29/12/2011 00:08, R A wrote: And if you want portable pre-processing or code generation, use something that generates the code rather than inventing tools and features that don't exist, nor will ever exist. It is also quite common to use scripts in languages like perl or python to generate

RE: a nifty feature for c preprocessor

2011-12-29 Thread R A
The gcc developers, and everyone else involved in the development of C as a language, are perhaps not superhuman - but I suspect their combined knowledge, experience and programming ability outweighs yours. given. but do you have a consensus of the community that this feature is not worth

Re: a nifty feature for c preprocessor

2011-12-29 Thread Ian Lance Taylor
R A ren_zokuke...@hotmail.com writes: The gcc developers, and everyone else involved in the development of C as a language, are perhaps not superhuman - but I suspect their combined knowledge, experience and programming ability outweighs yours. given. but do you have a consensus of the

Re: a nifty feature for c preprocessor

2011-12-29 Thread Xinliang David Li
The idea sounds useful to me .. Or perhaps introduce template into C :) David On Thu, Dec 29, 2011 at 1:12 PM, Ian Lance Taylor i...@google.com wrote: R A ren_zokuke...@hotmail.com writes: The gcc developers, and everyone else involved in the development of C as a language, are perhaps not

RE: a nifty feature for c preprocessor

2011-12-29 Thread Richard Kenner
given. but do you have a consensus of the community that this feature is not worth including? i haven't even heard but from a few people saying that it's not worth it because if it was, 'we're the ones to have thought about it'. No, that's not what people are saying. It's important to take a

RE: a nifty feature for c preprocessor

2011-12-29 Thread R A
I personally do not feel it is worth the effort. It's easy to use a more powerful macro processor, such as m4, to generate your C code. The benefit of building a more powerful macro processor into the language proper seems minimal. This particular extension seems problematic when

Re: a nifty feature for c preprocessor

2011-12-29 Thread David Brown
On 29/12/11 22:05, R A wrote: The gcc developers, and everyone else involved in the development of C as a language, are perhaps not superhuman - but I suspect their combined knowledge, experience and programming ability outweighs yours. given. but do you have a consensus of the community

Re: a nifty feature for c preprocessor

2011-12-29 Thread Ian Lance Taylor
R A ren_zokuke...@hotmail.com writes: This particular extension seems problematic when cross-compiling. In what environment should the expressions be evaluated? why are you asking for a specific environment? it's coding convenience and elegance for coding in c itself. simplest case

Re: a nifty feature for c preprocessor

2011-12-29 Thread James Dennett
On Thu, Dec 29, 2011 at 1:50 PM, David Brown david.br...@hesbynett.no wrote: On 29/12/11 22:05, R A wrote: The gcc developers, and everyone else involved in the development of C as a language, are perhaps not superhuman - but I suspect their combined knowledge, experience and programming

RE: a nifty feature for c preprocessor

2011-12-29 Thread R A
--- Date: Thu, 29 Dec 2011 16:30:04 -0800 Subject: Re: a nifty feature for c preprocessor From: james.denn...@gmail.com To: david.br...@hesbynett.no CC: ren_zokuke...@hotmail.com; gcc@gcc.gnu.org . I'd tend to agree; we ought to move functionality _out_

RE: a nifty feature for c preprocessor

2011-12-29 Thread R A
i meant general purpose macro processor. sorry.

Re: FW: a nifty feature for c preprocessor

2011-12-28 Thread David Brown
On 28/12/2011 07:48, R A wrote: i'm an amateur programmer that just started learning C. i like most of the features, specially the c preprocessor that it comes packed with. it's an extremely portable way of implementing metaprogramming in C. though i've always thought it lacked a single

RE: a nifty feature for c preprocessor

2011-12-28 Thread R A
To: ren_zokuke...@hotmail.com CC: gcc@gcc.gnu.org Subject: Re: FW: a nifty feature for c preprocessor On 28/12/2011 07:48, R A wrote: i'm an amateur programmer that just started learning C. i like most of the features, specially the c preprocessor that it comes packed with. it's

Re: a nifty feature for c preprocessor

2011-12-28 Thread Jonathan Wakely
On 28 December 2011 20:57, R A wrote: templates, i have no problem with, i wish there could be a C dialect that can integrate it, so i wouldn't have to be forced to use C++ and all the bloat that usually come from a lot of it's implementation (by that i mean a performance close to C i

Re: a nifty feature for c preprocessor

2011-12-28 Thread David Brown
: a nifty feature for c preprocessor On 28/12/2011 07:48, R A wrote: i'm an amateur programmer that just started learning C. i like most of the features, specially the c preprocessor that it comes packed with. it's an extremely portable way of implementing metaprogramming in C. though i've always

RE: a nifty feature for c preprocessor

2011-12-28 Thread R A
And if you want portable pre-processing or code generation, use something that generates the code rather than inventing tools and features that don't exist, nor will ever exist. It is also quite common to use scripts in languages like perl or python to generate tables and other

FW: a nifty feature for c preprocessor

2011-12-28 Thread R A
sorry: 2) it takes very little penalty, otherwise.

FW: a nifty feature for c preprocessor

2011-12-27 Thread R A
i'm an amateur programmer that just started learning C. i like most of the features, specially the c preprocessor that it comes packed with. it's an extremely portable way of implementing metaprogramming in C. though i've always thought it lacked a single feature -- an evaluation feature.