In article <1174596023.581460.11140@d57g2000hsg.googlegroups. com>,
..rhavin grobert <clqrq@yahoo.dewrote:
Quote:
>i read that the preproc will parse macros inside a string if they are
>prefixed with a sharp.
No, that is incorrect.
Quote:
>#define MAJORRELEASE 0
>#define PATCHLEVEL 7
Quote:
>#ifdef _DEBUG
#define MINORRELEASE 5
>#else
#define MINORRELEASE 4
>#endif
Quote:
>#define TXT_VERPRODUCT
>"#MAJORRELEASE.#MINORRELEASE.#PATCHLEVEL "
Try
#define STRING(val) #VAL
#define TXT_VERPRODUCT STRING(MAJORRELEASE) "." STRING(MINORRELEASE) "." STRING(PATCHLEVEL) " "
The # signals the preprocessor to construct a literal string
"containing the spelling" of the value passed to it. So
TXT_VERPRODUCT would get replaced with six literal strings
(including the " " at the end in the six). Then you rely upon
another feature of the preprocessor, namely that adjacent
literal strings are merged into a single string.
--
Programming is what happens while you're busy making other plans.