[aspectc-user] Newbie needs help

Marko Bozikovic bozho at kset.org
Tue Nov 16 15:09:04 CET 2004


Hi!

I've started playing with AspectC++, and I'm having some problems with that(). 
Here's the aspect code:


-- begin code

#include <iostream>
using namespace std;

#include "a.h"

pointcut new_A(class A& a) = construction("A") && that(a);
pointcut exec_A(class A& a) = execution("% A::exec(...)") && that(a);

aspect CounterA {

private:
    advice "A" : int nCounter;

public:
    advice new_A(a) : after(class A& a) {
       a.nCounter = 0;
       cout << "Creating A: " << a.nCounter << endl;
    }

    advice exec_A(a) : after(class A& a) {
       ++a.nCounter;
       cout << "Executing A: " << a.nCounter << endl;
    }
};

-- end code


Now, when I compile this (AspectC++ 0.9 on linux), I get errors:

main.ah:6: error: `a' undeclared here
main.ah:7: error: `a' undeclared here


According to the language reference, that() needs a type pattern - that(type 
pattern). Using 'that("A")' on lines 6 and 7, I get errors:

main.ah:1: error: Include recursion too deep (400)
main.ah:4: error: Include recursion too deep (400)

a.h defines a class A, that has ctor, dtor and void exec() function.

What am I doing wrong?

TIA,
-- 
Marko
ICQ: 5990814

I'm not under the alkafluence of inkahol
that some thinkle peep I am.
It's just the drunker I sit here the longer I get.




More information about the aspectc-user mailing list