I have the following sample from my code....
Code:
#include <stdio.h>
#define D \
#define
#define CMD(name,code) D CMD_##name #code" "#name
CMD( ACK, 069)
CMD( CLOSE, 255)
CMD( HELP, 131)
CMD( IDENT, 099)
int main()
{
printf("%s", CMD_HELP);
}
But when i try to compile the files using the #defined strings, i get the error:
test.c:7: error: stray ‘#’ in program
Is there a workaround? I know #define #define is generally not very common, but is possible and i would to know how to correctly use such a construction if it is not too much to ask, oh great masters...