[net.unix-wizards] 4.2 BSD Preprocessor Query

brett@wjvax.UUCP (04/23/86)

> I have a program in which I have a macro defining a number.  I want the
> C compiler/preprocessor to generate a string containing that number.
> For example ...
>
> #define	NUM	2
> #define	NUMSTR	"NUM"
>
> The problem is that the C preprocessor will not substitute NUM when it is
> in quotes.  My question (for this example) is whether there is any way to
> generate a macro with value "2" frm the macro NUM.

The concensus seems to be that the C preprocessor cannot be made to substitute
for macros within quotes.  Period.  Thank you to those who responded.  It is
rather disappointing that cpp can't be made to substitute in this case.
Oh well ...  at least I know that I have to find a work-around.

-------------
Brett Galloway
{pesnta,twg,ios,qubix,turtlevax,tymix,vecpyr,certes,isi}!wjvax!brett