[aspectc-user] Element counter example -- getting compile error

siva chelliah s.chelliah at samsung.com
Wed May 26 22:14:46 CEST 2004


 

Hi,

I am trying to test the code in the tutorial and getting a compile error. I
am using AC++ 0.8.1 on windows 2000 system. I am also using Borland c++
compiler.

 

C:\workspace>ac++ -p Queue  -d Queue-out -IQueue -v 9

* Running ac++ 0.8.1

* Simple Dependency Check

  - new or modified: Queue/ElementCounter.ah

  - new or modified: Queue/ErrorAspect.ah

* Handling Translation Unit `main.cc'.

  - Path "Queue/main.cc"

  - Inserting namespace AC

  - Parsing ...

Queue/ElementCounter.ah(12): error: invalid member declaration near token
`Queue

 

Here is the complete file:

 

aspect ElementCounter

{

      //int counter;

      private:

         advice "Queue" : int counter;

         

      public:

         

         advice "Queue" : int count() { return  counter; } <-- typo in the
tutorial[ int count instead of int count()]

         

      advice execution("% Queue::enqueue(...)") 

           && that(queue) : after(Queue& queue ) <-------------- this is the
error line

      {

            ++q.counter;

            printf("num ele after enqueue = %d\n", q.count());

      }

      

      advice execution("% Queue::dequeue(...)")

      && that(q) : after( Queue& q )

      {

            if (q.count() > 0) {

                   --q.counter;

            }

            printf("num ele after dequeue %d\n", q.count());

      }

};

 

Please help.

 

Siva Chelliah

Samsung Telecommunications America

1301 East Lookout Dr.   Richardson, TX 75082

972-761-7903 (fax: 7909)

A conclusion is simply the place where someone got tired of thinking

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.aspectc.org/pipermail/aspectc-user/attachments/20040526/a42e9411/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 2743 bytes
Desc: not available
URL: <http://www.aspectc.org/pipermail/aspectc-user/attachments/20040526/a42e9411/attachment.jpg>


More information about the aspectc-user mailing list