[aspectc-user] Pointers / Array
Olaf Spinczyk
Olaf.Spinczyk at informatik.uni-erlangen.de
Mon May 26 09:57:02 CEST 2003
Hi,
MNPR MNPR wrote:
> aspect abc
> {
> pointcut res(char *d,int g)=call(" * cd (...)");
> advice res(char *d,int g) : void before ()
> {
> validate (d,g);
> }
> };
>
> This is wht i want to do. here char *d, is a string,
> which should be passed as argument to validate.
> If i cant use *d, is there any other way of passing a
> string into the advice.
>
> Does aspectC++ support pointers?
> Thank You
> Bhadra
Of course AspectC++ supports pointers. Here is a revised version of your
code:
#include <stdio.h>
aspect abc
{
pointcut res(char *d,int g) = call("% cd(...)") && args(d, g);
advice res(d, g) : void before (char *d,int g)
{
printf ("%p-%s:%d\n", d, d, g);
}
};
void cd (char *d,int g) {
}
int main () {
cd ("my string", 42);
}
As you can see, there is no difference between the treatment of the
pointer and the integer. To expose the arguments of a call, use the args
pointcut function.
Yours,
Olaf
PS: we are currently working on a language reference manual, which will
explain this with more details.
More information about the aspectc-user
mailing list