Q:
hello
i want to ask about the following macro:
#define PRINTINT(x)fprintf (stderr, "The value of " #x \ in file" _FILE_ \
at line %d is %d\n",
_LINE_, x)
Question
my question is how to call the macro.
could you please give me an example of _DATE_,_TIME_ and _STDC_ macros?.
PS: thank you VERY MUCH for your help!
A:
Strings written joined to each other are made one string during compile
time. Thus if you call
PRINTINT(variable)
it will be converted to
fpprintf(stderr,"The value of " "variable" "in file" "myfile.c" "at line%d
is %d\n",__LINE__,variable)
The #x converts the macro argument to string.
Regards,
Peter
[ back to toc ]