[aspectc-user] First post

Fabian Scheler fabian.scheler at gmail.com
Mon Jul 17 08:18:32 CEST 2006


> 2) Why is the following not working?
>
> Hello.ah
>
>
> aspect Hello {
>         pointcut A_constructed() = "% A::A(...)";
>
>         advice execution(A_constructed()) : after () {
>                 std::printf("An object of type A is constructed.\n" );
>         }
> };
>
>
> main.cpp
>
> class A {};
>
>
> int main () {
>
>    A a;
>
>    return 0;
> }

you have to use the "construction" pointcut function

> 3) When trying to intercept with the destructor the AOP compiler
> doesn't like the ~ in the pointcut string?
>
> aspect Hello {
>         pointcut A_constructed() = "% A::A(...)";
>         pointcut A_destructed() = "% A::~A(...)";
>
>         advice execution(A_constructed()) : after () {
>                 std::printf("An object of type A is constructed.\n" );
>         }
>
>         advice execution(A_destructed()) : after () {
>                 std::printf("An object of type A is destructed.\n" );
>         }
>
> };

you have to use the "destruction" pointcut function

Ciao, Fabian



More information about the aspectc-user mailing list