I need to write a multi-line macro. I need this because I must have partial code that has been "paste" into specific points in my code. How can I do this?
It's not really clear from your question what you actually want, but a plain multi-line macro is defined as follows:
#define FOO something; \
something_else;
Of course, beware of the if .. else problem. If this is applicable to your case, you could wrap things into a do { ... } while(0) construct. This will ensure that it's treated as a single statement.
#define FOO do \
{ \
something; \
something_else; \
} while (0)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With