Mail Archives: djgpp/1999/06/16/16:15:04
Hans-Bernhard Broeker wrote:
> In article <3767F65C DOT B3E58FDC AT americasm01 DOT nt DOT com> you wrote:
> > Is there any way to write a #define who's expansion covers more than one
> > line? I already know how to make the definition span-lines, but when
> > expanded, they are cramped on a single line.
>
> No way. OTOH, why would anyone care? C preprocessor output is not
> meant to be read by anything but the C compiler, so why bother about
> long lines instead of several short ones?
I am actually using the C preprocessor to process html files. I needed
to display fractions in html, and I didn't want to have to make hundreds of
gif's, so I found a kinda obsure way of doing it with table's inside tables,
but it is a lot to type each time, so I thought I could make a C-style macro
which would expand in html. And I did and it works fine. The only problem
is the code is hard to read (if that is a problem, and I'm not convinced
either way). I was just wondering if there was a way around it.
> The only parts of the C programming language where a newline is
> required are preprocessing commands, anyway. With the preprocessor
> itself being a one-pass operation, you cannot generate preprocessor
> commands by macro-expansion, either, so there's no need for the
> preprocessor to be able to generate newlines.
That's not entirely true. You can use -DMAC=#define on a command-line to
make a macro that expands to a preprocessor directive.
--
-Rolf Campbell (39)3-6318
- Raw text -