preprocessor question (non-ANSI)

Leo de Wit leo at philmds.UUCP
Thu Oct 12 21:56:17 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?
| `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.

Agreed; it does not work e.g. in Ultrix 2.x 8-) (recursive macro).

For the original poster: seems you want to know the current line of an
embedded SQL statement; if you happen to use Oracle as your DBMS, you
can include oraca.h and inspect the value of oraca.oraslnr (this is the
line number in the original source code, not the precompiled one).

    Leo.



More information about the Comp.lang.c mailing list