This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Cpplib document: Macro Expansion algorithm
- To: "Gao, Jiafu" <JGao at seisint dot com>
- Subject: Re: Cpplib document: Macro Expansion algorithm
- From: Neil Booth <neil at daikokuya dot demon dot co dot uk>
- Date: Tue, 29 May 2001 23:05:18 +0100
- Cc: "'gcc at gcc dot gnu dot org'" <gcc at gcc dot gnu dot org>
Gao, Jiafu wrote:-
> I am working on a project which needs similar functionality like
> the C/C++ macro expansion. I found the GNU GCC project has a
> pretty good CPP library. Unfortunately, the document for macro
> expansion algorithm part is empty.
>
> http://gcc.gnu.org/onlinedocs/cppinternals_6.html#SEC6
>
> I am wondering if this is left out unintentionally or intentionally? Is
> it possible to get some help (either in formal/informal document, or
> answering some questions) from the author?
Well, the only reason it's left out is that I haven't written it yet
;-)
I haven't written it yet for many reasons. Like I've found other
things to do that seemed more fun at the time, and that describing the
algorithm is kind of difficult; it's easy to make your description
more complicated than the algorithm itself is if you're not careful.
Pictures would make it a lot easier.
In my not entirely unbiased opinion, the code is quite clean and not
too hard to understand. There are plenty of subtleties, though, and
before trying to figure it out by looking, I would take some time to
make sure you completely understand the way the C standard intends
that macros expand.
Feel free to ask the odd question or two. But please heed my advice
above first.
Neil.