Here is what I have (message () - a specialized logging function from a third-party library):
#define LOG(fmt, ...) message("%s %s(): #fmt", __FILE__, __func__, __VA_ARGS__);
So, I want to be able to do things like:
LOG("Hello world")
LOG("Count = %d", count)
And expand it:
message("%s %s(): Hello world", __FILE__, __func__);
message("%s %s(): Count = %d", __FILE__, __func__, count);
But the #fmt function does not work. It does not evaluate the macro argument and prints as "#fmt". Can I do what I'm trying to do?
Rich source
share