[aspectc-user] destructive construction

arnd-hendrik.mathias at nefkom.net arnd-hendrik.mathias at nefkom.net
Sat Apr 5 09:18:36 CEST 2008


Hi,
I found some strange behavior which looks like a bug with the  
construction pointcut function:

- I define a class "Test" with an array as member ("members"). The  
array has the length of the number of elements of another class  
("Members").
- The other class ("Members") is extended by one aspect ("FillMembers").
- Another aspect ("TestConstruction") advices on construction of my  
testclass ("Test").
- The member array ("members") of the testclass ("Test") vanishes  
completely as a consequence of the construction ( "Test" ) pointcut  
advice.
- If the construction ( "Test" ) pointcut advice is commented out, the  
member array ("members") of the testclass ("Test") exists as desired.

This behavior is independent of whether I use before(), after() or  
around() with proceed () and also independent of whether any  
non-default constructors are defined or not.
The tool versions I've tested with are:

tricore-g++ (GCC) 3.3 built for Linux on 2005-06-23 Tool Version v6.1

g++ (GCC) 4.1.2 (Ubuntu 4.1.2-0ubuntu4)

ag++ 0.6  built: Mar 16 2006

ac++ 1.0pre3 (Mar 16 2006)

(yes, I tested with different platform versions).

I've attached a demo, stripped down to the core. The different sizes  
of the "object" instance of the "Test" class can also be viewed  
utilizing "nm -S main | grep object". The effect also appears in  
bigger implementations (this means, it does not come from the  
emptiness of the advice or any other stuff). I just reduced it for a  
better overview of the essential problem.

Have a nice day

Arnd-Hendrik
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.cc
Type: text/x-c++src
Size: 403 bytes
Desc: not available
URL: <http://www.aspectc.org/pipermail/aspectc-user/attachments/20080405/263865bc/attachment.cc>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.hh
Type: text/x-c++hdr
Size: 180 bytes
Desc: not available
URL: <http://www.aspectc.org/pipermail/aspectc-user/attachments/20080405/263865bc/attachment.hh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.ah
Type: application/octet-stream
Size: 219 bytes
Desc: not available
URL: <http://www.aspectc.org/pipermail/aspectc-user/attachments/20080405/263865bc/attachment.obj>


More information about the aspectc-user mailing list