[aspectc-user] args() question & aspectof question

Hans VB hans.vanbroeckhoven at telenet.be
Wed Apr 13 03:56:51 CEST 2005


Hi,

I have two questions :

1. The args() function not only selects join points but also stores 
context information. Is it correct to say the name of the argument can 
differ between the pointcut- and advice-declaration because of the 
existance of this context information? Am i correct in presuming this 
'context information' is added to poincuts which use args() ? I'm a bit 
in doubt about the actual meaning of 'context information'.

I take the example from the ac++ manual where 'name' is replaced by 
'username' in the advice-declaration :
pointcut new_user(const char *name) = execution ("void login(...)") && 
args(name);
advice new_user(username) : before(const char* username) { ... }

2. In the ac++ manual the following (slightly modified) example is given 
concering aspect instantiation :
aspect ThreadCounter {
  advice "Thread" : ThreadCounter m_instance;
  static ThreadCounter *aspectof() {
    return tjp->target()->m_instance;
  }
};

In a similar example (though in a completely different scenario than 
with these Threads) I got many errors:
cannot convert `AnAspect' to `AnAspect*' in return.
(it seems always 2 more of these errors more than I have 
advice-declarations).
I solved this by changing this :
    return *(tjp->target()->m_instance);
It works but only if there is no advice from global functions (like 
main()). If there is advice for main() I get an error: `void*' is not a 
pointer-to-object type. (this error i also got in the first case btw)

Can someone tell me what I could be doing wrong here ?

Thanks in advance,
Hans




More information about the aspectc-user mailing list