[aspectc-user] Around advice and return values
Loesch Felix (CR/AEF4)
Felix.Loesch at de.bosch.com
Thu May 12 09:21:41 CEST 2005
Hello,
I tried to use around advice with return values with AspectC++, but I
was unable to use return values inside
advice code.
I tried the following example code but always got the following error of
the AspectC++ compiler:
--- error begin ---
../MinValue.ah: In member function `void MinValue::__a0_around(int, int,
int)':
../MinValue.ah:9: error: return-statement with a value, in function
declared
--- error end ----
---- begin main.cpp ----
#include <stdio.h>
using namespace std;
// compute max value of i, j, k
int REF(int i, int j, int k) {
int max = 0;
max = i;
if (j > max) { max = j; }
if (k > max) { max = k; }
return max;
}
int main() {
printf("Reference value: %d", REF(3,5,4));
}
--- end main.cpp---
MinValue.ah
--- begin MinValue.ah ----
#include <stdio.h>
#include <stdio.h>
aspect MinValue {
advice call("int REF(...)") && args(i,j,k) : int around(int
i,int j,int k) {
int min = 0;
min = i;
if (j < min) { min = j; }
if (k < min) { min = k; }
return min;
}
};
--- end MinValue.ah ---
- Why does AspectC++ declare the inlined function as "void"?
- Why does AspectC++ not support return types of functions that are
replaced by "around" advice?
- Is there a workaround to support return statements in advice code?
--
Felix Loesch
More information about the aspectc-user
mailing list