将宏参数转换为字符串的预处理器操作符
语法
#macro_argument
说明
该运算符将macro_argument 转换为一个字符串,其值为参数的名称。这种替换是在宏扩展之前,在编译之前进行的。
Note: because of this feature, care should be taken when using file-handling statements in a macro. Because of potential ambiguity with file-handling statements that take a "# filenum" parameter, if filenum is one of the macro parameters, it may be necessary to wrap the filenum expression in parenthesis (e.g. "#( filenum)"), to separate it from the # sign. Otherwise, filenum will be stringized in the macro.
例子
#define SEE(x) Print #x ;" = "; x
Dim variable As Integer, another_one As Integer
variable=1
another_one=2
SEE(variable)
SEE(another_one)
输出:
variable = 1
another_one = 2
与QB差别
参考