4.2 BSD Preprocessor Query (result)
brett at wjvax.UUCP
brett at wjvax.UUCP
Thu Apr 24 02:58:38 AEST 1986
> 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
More information about the Comp.unix.wizards
mailing list