[aspectc-user] Aspect data members

Olaf Spinczyk Olaf.Spinczyk at informatik.uni-erlangen.de
Tue Sep 4 13:02:31 CEST 2007


Hi Francisco,

if you tried the same with a C++ class instead of an aspect, the C++ compiler
would complain as well. The problem is that you can't create an attribute with a
constructor argument as you did it ("Test xyz(99)"). The only way to pass a
constructor argument to an attribute instance is via the constructor of the
aggregating class:

aspect myAspect {
  Test xyz;
public:
  myAspect () : xyz (99) {}
  ...
};

This should work (haven't tried).

Best regards,

Olaf


Francisco Afonso schrieb:
> Hi,
> 
> I am receving the following error message in the code bellow:
> 
> exec.ah: 15 error: invalid member declaration near token Ž99'
> 
> //------------- exec.ah
> 
> class Test{
> 
>  int myInt;
> 
>  Test(int var): myInt(var) {}
> 
> };
> 
> aspect myAspect {
> 
>  Test xyz(99);   // this is line 15
> 
>  advice execution ("% MyClass::method%(...)"): before(){
>    // some printf here
>  }
> };
> 
> //--------------------------
> 
> It seems to me that AspectC++ does not allow creating aspect data
> members with construction arguments.
> 
> Is this a bug or am I doing something wrong?
> 
> Thanks,
> 
> Francisco
> 
> _________________________________________________________________
> Kick back and relax with hot games and cool activities at the Messenger
> Café. http://www.cafemessenger.com?ocid=TXT_TAGHM_SeptHMtagline1
> 
> _______________________________________________
> aspectc-user mailing list
> aspectc-user at aspectc.org
> http://www.aspectc.org/mailman/listinfo/aspectc-user




More information about the aspectc-user mailing list