J
John Devereux
Hi,
I would like to be able to define a number with the preprocessor, then
be able to use it to generate both numeric and string constants.
For example,
#define VERSION_MAJOR 4
#define VERSION_MINOR 47
#define VERSION_STRING "v" #VERSION_MAJOR "." #VERSION_MINOR
The above does not work but hopefully illustrates what I would like to
do, i.e. make VERSION_STRING end up as "v4.47".
Of course I realise I can use runtime C code to build strings
containing what I want, but I am thinking there must be a way to do it
with the preprocessor.
Thanks,
I would like to be able to define a number with the preprocessor, then
be able to use it to generate both numeric and string constants.
For example,
#define VERSION_MAJOR 4
#define VERSION_MINOR 47
#define VERSION_STRING "v" #VERSION_MAJOR "." #VERSION_MINOR
The above does not work but hopefully illustrates what I would like to
do, i.e. make VERSION_STRING end up as "v4.47".
Of course I realise I can use runtime C code to build strings
containing what I want, but I am thinking there must be a way to do it
with the preprocessor.
Thanks,