P
P L
I have codes with blocks like this:
void h() {
..
..
..
a;
b1;
b2;
..
..
..
bn;
c;
..
..
..
}
and I need to change it to something like:
static void g()
{
b1;
b2;
..
..
..
bn;
}
void h() {
..
..
..
a;
#ifdef ABC
b1;
b2;
..
..
..
bn;
#else
f(g); /* f is some function taking g as arg */
#endif
c;
..
..
..
}
I don't like to copy the blocks because of two reasons: there are lot
of such changed need to be made; and any future changes in b1; ...; bn
will need changes in two places. I am reluctant to add a lot of
backslashes and put b1; ...; bn in a macro; and would prefer some
other elegant way. Can someone shed some light? Thanks. - PL
void h() {
..
..
..
a;
b1;
b2;
..
..
..
bn;
c;
..
..
..
}
and I need to change it to something like:
static void g()
{
b1;
b2;
..
..
..
bn;
}
void h() {
..
..
..
a;
#ifdef ABC
b1;
b2;
..
..
..
bn;
#else
f(g); /* f is some function taking g as arg */
#endif
c;
..
..
..
}
I don't like to copy the blocks because of two reasons: there are lot
of such changed need to be made; and any future changes in b1; ...; bn
will need changes in two places. I am reluctant to add a lot of
backslashes and put b1; ...; bn in a macro; and would prefer some
other elegant way. Can someone shed some light? Thanks. - PL