[aspectc-user] non-inline introduction

arnd-hendrik.mathias at nefkom.net arnd-hendrik.mathias at nefkom.net
Wed Mar 26 08:32:01 CET 2008


So, I cannot add a slice of a static member to a virtual class, at all?
Ok, so adding a constructor for Device helps one step further, but I  
still seem to have completely misunderstood something, for I now get  
errors for two things:

devices.ah:37: error: invalid statement near token `::'

where I try to reference it in my advice:

aspect Counter
{
    pointcut devices () = derived ( "Device" );
    pointcut main () = execution ( "% main (...)" );

    advice "Device" : slice Devcounter;

    advice main () : before ()
    {
       cout << "counter = " << Devcounter::counter << ";\n";
    };
};

And what's looking even worse

devices.ah:28: error: redefinition of `Counter'
devices.ah:28: previously defined here
devices.ah:28: error: wrong use of `Counter'

How can I redefine an aspect previously defined in the same line of  
the same file with the same statements? I grep-ped for any  
unintentional inclusions but I haven't included this file in any other  
one.

Zitat von Panu Bloigu <panu.bloigu at gmail.com>:

> Hello.
>
> Arnd-Hendrik Mathias wrote:
>> I just tried this, resulting in our friendly ag++ claiming:
>>
>> warning: cannot introduce non-inline function or static attribute   
>> into "class Device". It has to contain link-once code.
>>
>> which I don't understand.
>>
>
>
> I have encountered the exact same error message! Please see Daniel
> Lohmann's explanation of the message on the list on 2008-01-06:
> http://aspectc.org/pipermail/aspectc-user/2008-January/001220.html
>
>
>> Francisco Afonso wrote:
>>> And if you use named slices?
>>>
>>> //------------------------------
>>>
>>> slice class mySlice{
>>> public:
>>>   static unsigned int counter;
>>> };
>>>
>>> slice unsigned int mySlice::counter = 0;
>>>
>>>
>>> aspect Counter{
>>>   advice "Device": slice mySlice;
>>> };
>>> //--------------------------------------------------
>>>
>>> Regards,
>>>
>>> Francisco Afonso
>>>
>>>
>>>> Date: Tue, 25 Mar 2008 10:36:50 +0100
>>>> From: arnd-hendrik.mathias at nefkom.net
>>>> To: aspectc-user at aspectc.org
>>>> Subject: [aspectc-user] non-inline introduction
>>>>
>>>> Hi,
>>>> I'm tryin' to introduce a new static member to a class including the
>>>> corresponding non-inline introduction. The code I'm using looks like
>>>> this:
>>>>
>>>> /** \code */
>>>>
>>>> class Device
>>>> {
>>>> unsigned char devspeed;
>>>> unsigned char devclass;
>>>> unsigned char devsubclass;
>>>> unsigned char devprotocol;
>>>> };
>>>>
>>>> aspect Counter
>>>> {
>>>> advice "Device" : slice class
>>>> {
>>>> public : static unsigned int counter;
>>>> };
>>>> };
>>>>
>>>> slice unsigned int Device::counter = 0;
>>>>
>>>> /** \endcode */
>>>>
>>>> Which looks pretty much like the example given in section 5 of the
>>>> ac-language-reference page 27. Nevertheless ag++ reports an "error:
>>>> invalid introduction" to me.
>>>> I also tried to put the non-inline introduction into the aspect. Which
>>>> only makes things different but not better. Can anyone give me some
>>>> good advice (or at least some better slice than mine ;-)
>>>> Best regards
>>>>
>>>> Arnd-Hendrik
>>>>
>>>>
>>>> _______________________________________________
>>>> aspectc-user mailing list
>>>> aspectc-user at aspectc.org
>>>> http://www.aspectc.org/mailman/listinfo/aspectc-user
>>>
>>> ------------------------------------------------------------------------
>>> How well do you know your celebrity gossip? Talk celebrity   
>>> smackdowns here.   
>>> <http://originals.msn.com/thebigdebate?ocid=T002MSN03N0707A>
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> 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