preprocessor question (non-ANSI)

Piet van Oostrum piet at cs.ruu.nl
Tue Oct 10 19:25:12 AEST 1989


In article <174 at eliza.edvvie.at>, johnny at edvvie (Johann Schweigl) writes:
 `How can I replace a text token by itself, along with some additional text?
 `Example: 
 `EXEC SQL select * from emp;     __curline = 23; EXEC SQL select * from emp;
 `before ^^^^^^^^^^^^^^^^^^^^     after ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 `
 `#define EXEC __curline = __LINE__; EXEC 
 `is not the solution, cpp would try to resolve EXEC recursively

If your preprocessor is non-ANSI, you might try:

	#define EXEC __curline = __LINE__; EX/**/EC 

or something similar. Note that this is very unportable.
-- 
Piet van Oostrum, Dept of Computer Science, University of Utrecht
Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht,  The Netherlands.
Telephone: +31-30-531806      Internet: piet at cs.ruu.nl
Telefax:   +31-30-513791      Uucp: uunet!mcsun!hp4nl!ruuinf!piet



More information about the Comp.unix.questions mailing list