0

I wonder how to write multiple instruction in Objective C macro. For example, I want to create a macro which runs two instructions below,

NSLog(message);
DDLogDebug(message);

I tried,

#define LOGMESSAGE(message) (NSLog(message);DDLogDebug(message);)

But it gave me compiler errors.

Sazzad Hissain Khan
  • 37,929
  • 33
  • 189
  • 256

1 Answers1

2

You can write multiple line macro like this:

#define LOGMESSAGE(message) \ NSLog(message); \ DDLogDebug(message); \

Or use one line version (whithout parenthesis):

#define LOGMESSAGE(message) NSLog(message);DDLogDebug(message);
Mato Peto
  • 96
  • 3