preprocessor question (non-ANSI)
Barton E. Schaefer
schaefer at ogccse.ogc.edu
Wed Oct 11 02:52:02 AEST 1989
In article <1679 at ruuinf.cs.ruu.nl> piet at cs.ruu.nl (Piet van Oostrum) writes:
} 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?
} `EXEC SQL select * from emp; __curline = 23; EXEC SQL select * from emp;
} `before ^^^^^^^^^^^^^^^^^^^^ after ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
} If your preprocessor is non-ANSI, you might try:
}
} #define EXEC __curline = __LINE__; EX/**/EC
This doesn't quite work; cpp apparently re-evaluates the token as soon
as it has stripped the /**/, so it becomes recursive. To completely
fool cpp, you must use the horrible
#define EXEC __curline = __LINE__; EX//**/**/**//EC
} Note that this is very unportable.
No kidding.
--
Bart Schaefer "A Yellowbeard is never so dangerous as when he's dead."
-- Graham Chapman, 1941-1989
CSNET / Internet schaefer at cse.ogc.edu
UUCP ...{sequent,tektronix,verdix}!ogccse!schaefer
More information about the Comp.lang.c
mailing list