小编abs*_*urd的帖子

我可以确定参数是否是字符串文字?

是否可以确定在宏或函数中传递的参数在编译时或运行时是否是字符串文字?

例如,

#define is_string_literal(X)
...
...   

is_string_literal("hello") == true;
const char * p = "hello";
is_string_literal(p) == false;
Run Code Online (Sandbox Code Playgroud)

要么

bool is_string_literal(const char * s);

is_string_literal("hello") == true;
const char * p = "hello";
is_string_literal(p) == false;
Run Code Online (Sandbox Code Playgroud)

谢谢.

c c++

18
推荐指数
4
解决办法
7550
查看次数

标签 统计

c ×1

c++ ×1