Replies: 3 comments
-
Would something like this work for you? #include <stdio.h>
#define STRINGIFY(x) STRINGIFY_HELPER(x)
#define STRINGIFY_HELPER(x) #x
#define ZLIBNG_VER_STATUS F
int main() {
const char* verStatusString = STRINGIFY(ZLIBNG_VER_STATUS);
printf("Macro literal value: %s\n", verStatusString);
return 0;
} |
Beta Was this translation helpful? Give feedback.
-
Hey @Dead2 already been down that path but it is not quite what I need The use-case here is where these macros get processed by C to Perl interface code that auto-generates Perl variables that match C symbols. To make that happen without jumping through hoops I need to end up with the equivalent of Last thing tried was this, but that doesn't work.
that ends up with
If this cannot be achieved with the C pre-processor, I can do a workaround. |
Beta Was this translation helpful? Give feedback.
-
I've worked around the issue. Closing. |
Beta Was this translation helpful? Give feedback.
-
With the 2.1.2 release just out the value of
ZLIBNG_VER_STATUS
has morphed from a number to the letterF
. This is documented in the definition ofZLIBNG_VER_STATUS
Preciously I assumed it was a integer and my code does something like this
To deal with it now being either a number or a letter, I need to read the value as a string, but C macro magic doesn't seem to give me a way to wrap the value of
ZLIBNG_VER_STATUS
in double quotes.Any ideas?
Beta Was this translation helpful? Give feedback.
All reactions