cpp 中的宏扩展和连接

问题描述 投票:0回答:0

我在 cpp 项目中使用以下宏记录,

#define TRACE(str,...)  TR_INFO(attr, str, ##__VA_ARGS__)

现在我想用另一个宏打印一个额外的字符串,例如,

#define TRACE(str,...)       TR_INFO(attr, str, ##__VA_ARGS__)
#define TRACE_FUNC(str,...)  TR_INFO(attr, "some text %s", str,  ##__VA_ARGS__)

它因编译器错误而失败。

我怎样才能做我想做的事?

c++ macros trace expansion
© www.soinside.com 2019 - 2024. All rights reserved.