[aspectc-user] Aspects advicing aspects
Panu Bloigu
panu.bloigu at mbnet.fi
Wed Jan 3 12:01:35 CET 2007
Hello.
My question concerns aspects "accidentally" advicing each others code. Or
more specifically, aspects advicing other aspects' advices. To make any
sense of this, please consider the following three files:
===================
File 1: main.cpp
===================
int main()
{
return 0;
}
===================
File 2: Base.ah
===================
#ifndef BASE_AH_
#define BASE_AH_
#include <iostream>
#include "functions.h"
aspect Base
{
advice execution("int main()") : around()
{
f();
tjp->proceed();
}
advice call("void f()") : around()
{
std::cout<<"Before f()\n";
tjp->proceed();
std::cout<<"After f()\n";
}
};
#endif /*BASE_AH_*/
===================
File 3: Functions.h
===================
#ifndef FUNCTIONS_H_
#define FUNCTIONS_H_
#include <iostream>
void f()
{
std::cout<<"f()\n";
}
#endif /*FUNCTIONS_H_*/
===================
Now the compiler presents me with plethora of errors. My question is twofold:
1) Is there something (semantically if not even syntactically) wrong with my
code or is the above presented construction illegal in AspectC++?
2) If it is illegal, then what should I do if I need to add a call to f()
before main() executes and at the same time want to decorate all calls to
f() with an around advice (f() is called from other places in my program
too)?
Panu.
More information about the aspectc-user
mailing list