The # symbol can be placed in front of a formal macro argument in order to convert the actual argument to a string after replacement.
Given the following definition:
#define TRACE(flag) printf(#flag "=%d\n", flag)the code fragment
int highval = 1024;
TRACE(highval);becomes
int highval = 1024;
printf("highval" "=%d\n", highval);which, in turn, is treated as
int highval = 1024;
printf("highval=%d\n", highval);|
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
|
What do you think about this topic? Send feedback!
|