For example, here is a C common #define:
#define USERNAME_LEN 100
#define SCAN_FMT "%100s"
// str is input from somewhere
char username[USERNAME_LEN + 1];
ret = sscanf(str, SCAN_FMT, username);
// check ret == 1 ?
can we have something like:
#define SCAN_FMT "%" USERNAME_LEN "s"
of course, this syntax is not what we want, but the ultimate goal is to mix numeric #define into string #define
Note: I know we can do something like:
sprintf(SCAN_FMT, "%%ds", USERNAME_LEN); // char SCAN_FMT[10];
but this is not what I am looking for, because it requires run-time generation, the best is to base on ANSI-C or std99.