About Macro
C or C++ is a language that one can always tweak to dig out something helpful but graceless. Below is an example I recently used to solve the problem of one of my colleagues. I think it is not astounding to sophisticated C programmers that macro can make so much trouble.
#include <stdio.h>
}
#include <stdio.h>
#define nameprint2(n) #n
#define nameprint(n) nameprint2(n)
#define nameprint(n) nameprint2(n)
#define name1() win
#define name2() dows
#define name() windows #define dotH() .h
#define name2() dows
#define name() windows #define dotH() .h
#define cat3(a,b,c) a##b##c
#define cat2(a,b) a##b
#define incname2 nameprint(cat2(name(),dotH()))
#define incname3 nameprint(cat3(name1(),name2(),dotH()))
#include incname2
//#include incname3
int main (void)
{
char *p = incname2; HANDLE h; // this needs `windows.h' to be included
{
char *p = incname2; HANDLE h; // this needs `windows.h' to be included
printf("%s/n", p);
return 0;
}
enjoy every minute of an appless, googless and oracless life