[aspectc-user] Pointcut expressions for any line of code; that vs target

Olaf Spinczyk os at aspectc.org
Wed Jul 30 19:45:40 CEST 2014

Hi Jannis!

Am 30.07.2014 18:41, schrieb Jannis Stoppe:
> Hi!
> Currently digging my way through AspectC++, everything works nicely so 
> far, but some questions come up that I can't seem to answer myself... 
> Any help would be appreciated.
>   * Can I match anything besides function calls and type names? E.g. I
>     could use the type matching expression to first replace a field
>     with according get and set methods and then replace all
>     expressions in the code that read or write that field with the
>     according calls? How would I match all expressions that access
>     that field? Is there something like regex matching like in

There is no set/get pointcut in AspectC++. Due to alias problem this is 
much harder to implement than, for instance, in AspectJ. Recently a 
student of mine has begun to work on this feature, but that work will 
take some time. Not a single line of code has been written yet.

>  *
>   * What is the difference between /that/ and /target/? Using
>     /tjp->that()/ from within an aspect that was woven in via an
>     execution advice I get a reference to the object that would
>     usually be /this/ inside the function that is currently being
>     executed, correct? What do I get with /tjp->target()/ as opposed
>     to that?

In execution advice I would normally only use that(). Its semantic is 
that it represents the "this" pointer at the joinpoint. The target() 
function has the same meaning in execution advice. The difference is 
only relevant in call advice, where that() points to the calling object 
and target() to the called object. If you write very generic advice code 
that is executed for call *and* execution joinpoints, it might be useful 
to have an implementation for target() even for execution joinpoints.

> Thanks in advance and best regards
> Jannis

You're welcome. I hope this helps.

Best regards,


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.aspectc.org/pipermail/aspectc-user/attachments/20140730/fb6dff42/attachment.html>

More information about the aspectc-user mailing list