I'm trying to create a macro definition that can emit C++ or Objective-C depending on context but can't seem to construct an NSString inside a macro easily. The C++ version is simple because it uses regular strings, but making one that emits NSString is proving tricky:
#define FOO(x) bar(@##x)
The intended result is to convert a string argument to an NSString argument by prefixing with @:
FOO("x")
// => bar(@"x")
What I get instead is an error that prevents compilation:
Pasting formed '@"x"', an invalid preprocessing token