A
Ann O'Nymous
I have a macro function that's like the following:
int function2(int*,int,int,int);
#define xyz(a,b,c) {\
int x[100],i; \
for(i=0;i<c;i++) x = something(a,b,c); \
function2(x,a,b,c); \
}
where "something" is a mathematical expression of a,b and c, and
"function2" is a function returning int.
Calls like:
xyz(1,2,3);
work fine, other than the return value of "function2" gets thrown away.
Now, if I want to do this:
int jkl;
....
jkl = xyz(1,2,3);
....
where "jkl" is to get that value returned by "function2", how do I do
it? I'm having trouble with the syntax.
I want things to expand where:
jkl = xyz(p,q,r);
expands equivalently to:
{
int x[100],i;
for(i=0;i<r;i++) x = something(p,q,r);
jkl = function2(x,p,q,r);
}
int function2(int*,int,int,int);
#define xyz(a,b,c) {\
int x[100],i; \
for(i=0;i<c;i++) x = something(a,b,c); \
function2(x,a,b,c); \
}
where "something" is a mathematical expression of a,b and c, and
"function2" is a function returning int.
Calls like:
xyz(1,2,3);
work fine, other than the return value of "function2" gets thrown away.
Now, if I want to do this:
int jkl;
....
jkl = xyz(1,2,3);
....
where "jkl" is to get that value returned by "function2", how do I do
it? I'm having trouble with the syntax.
I want things to expand where:
jkl = xyz(p,q,r);
expands equivalently to:
{
int x[100],i;
for(i=0;i<r;i++) x = something(p,q,r);
jkl = function2(x,p,q,r);
}