Use \ to avoid every line break that you want to be part of the macro.
However, keep in mind that using such macros can hide the structure if you are not careful. Example:
if (bar)
FOOBAR();
else
do_something_else();
, . , , . ( ):
if (bar)
if (foo)
{
[Bar fooBar];
}
;
else
do_something_else();
Oops! . if ; if if, if ({…}), , .
, if -it . , else .
, , , , FOOBAR do…while:
#define FOOBAR() \
do { \
if (foo) \
[Bar fooBar]; \
} while(0)
, do…while - , . :
if (bar)
FOOBAR();
else
do_something_else();
if (bar)
do
{
if (foo)
[Bar fooBar];
}
while(0);
else
do_something_else();
else if (bar), .