c++ 宏 #val 在unicode下的使用。

#define CHECK(condition) cout<<check failed:<<#condition<<endl;

上面这句宏,当你 CHECK(myfunc()); 时,假设myfunc返回false,会输出:check failed:myfunc() 

在宏中,#condition 是把参数转换为字符串,这在打印log时,可以很方便的打印出函数名称等等

这个大家可能都知道了,太小儿科了,但是,当你在unicode下用的时候,很可能会出现乱码

解决的办法是 #condition 替换为 L## #conditon

#define CHECK(condition) cout<<check failed:<<L## #condition<<endl;

原文地址:https://www.cnblogs.com/lebronjames/p/3193581.html