cpp replaced by m4?
Thomas Charron
twaffle at gmail.com
Tue Jul 3 12:49:12 EDT 2007
On 7/3/07, Steven W. Orr <steveo at syslang.net> wrote:
> On Tuesday, Jul 3rd 2007 at 09:52 -0400, quoth Thomas Charron:
> =>On 7/2/07, Steven W. Orr <steveo at syslang.net> wrote:
> =>> On Mon, 2 Jul 2007 16:34:45 -0400 (EDT)
> =>> "Steven W. Orr" <steveo at syslang.net> wrote:
> =>> I got that part. What I want to know is if anyone else has satisfied a
> =>> need for a more featureful preprocessor in their C code, whether it be via
> =>> use of m4 or something else. Whatever is used, I'd like to see if there is
> =>> any setup to save me any of the work of figuring out how to use it. I
> =>> don't care about ISO or platform dependance. Preferably, I'd like to run
> =>> my replacement first and then maybe process the output of that as regular
> =>> C code.
> => Can we have an example of why you want to do this?
> Sure. For starters, one thing that we're looking to do:
> Loops.
>
> int *arr[]() = {
> #for ii in l1 l2 l3 l4 etc
> #do
> func##cpp_eval(ii),
> #done
> };
I understand now. But from a practical standpoint, I've always
dreaded this sort of automated code generation. I'd honestly say use
something like perl to autogenerate it, as others have apparently
suggested. But any sort of text processor could be used as a prebuild
step to process a file.
> Another would be much more complicated to describe, but involves being
> able to get access to individual arguments of variadic macros one at a
> time to compute what the macro should produce as output.
> Is this description of any use?
Aye, I only wince because when I've seen it done in other peoples
code, I'd typically been there AFTER they made the mess and left, and
debugging what was actually going on in the code made baby tommy cry.
:-)
--
-- Thomas
More information about the gnhlug-discuss
mailing list