[aspectc-user] concrete aspects: can or can not be inherited from?

Panu Bloigu panu.bloigu at mbnet.fi
Fri Mar 23 17:51:19 CET 2007


Hello.

Yet more information on the subject. The code I presented compiles and 
runs when compiled in Windows environment with cygwin as a backend. 
However, on a Debian box following errors are printed by the compiler:

============================================================================= 

**** Build of configuration Debug for project Inheritance ****

make -k all
Building puma.config
"/opt/eclipse-3.2.2/plugins/org.aspectc.compiler.linux_0.9.93/AC/ag++" 
--gen_config -o "puma.config"

Building file: ../main.cpp
Invoking: GCC C++ Compiler
"/opt/eclipse-3.2.2/plugins/org.aspectc.compiler.linux_0.9.93/AC/ag++" 
-r repo.acp -p .. -I.. --c_compiler g++ -O0 -g3 -Wall -fmessage-length=0 
-o"main.o" -c "../main.cpp" --Xweaver --keywords && \
echo -n main.d ./ > main.d && \
g++ -MM -MG -P -w -include../Aspectc.ah -O0 -g3 -Wall -c 
-fmessage-length=0 "../main.cpp" >> main.d
main.acc: In member function ‘void TJP__ZN4mainEv_1::proceed()’:
main.acc:79: error: ‘invoke_Inherited_Inherited_a0_around’ is not a 
member of ‘AC’
main.acc:79: error: expected primary-expression before ‘>’ token
error: Execution failed: "g++" -I".." -O0 -g3 -Wall -fmessage-length=0 
-c -xc++ "main.acc" -xnone -I"../" -o "main.o"
make: *** [main.o] Error 1
make: Target `all' not remade because of errors.
Build complete for project Inheritance
============================================================================= 


On both machines Eclipse 3.2.2 was used with ACDT 3.1.0. The g++ version 
on the Debian box is '4.1.2 20061115 (prerelease) (Debian 4.1.1-21)' and 
the g++ on cygwin is '3.4.4 (cygming special, gdc 0.12, using dmd 
0.125)'. However, I don't thing that the backend compiler matters here. 
Instead, ac++ seems to generate different code on these machines. Which 
one is correct, that I do not know.

Panu.


Panu Bloigu wrote:
> Hello.
>
> Until recently I've been under the impression that only abstract 
> aspects can be inherited from. Now I'm not so sure anymore. I'll 
> present some code that I find rather confusing as it seems that 
> concrete aspects indeed *can* be inherited from.
>
> ============================================================================= 
>
> #include <iostream>
> aspect Base
> {
> pointcut pc() = "int main()";
> advice execution(pc()) : around()
> {
> std::cout<<"Before from base!\n";
> tjp->proceed();
> }
> };
>
> class Class : public Base
> {
> public:
> Class(){}
> virtual ~Class(){} };
>
>
> aspect Inherited : public Class
> {
>
> advice execution(pc()) : around()
> {
> std::cout<<"Before from Inherited!\n";
> tjp->proceed();
> } };
> ============================================================================= 
>
>
> This compiles fine and prints out:
>
> Before from base!
> Before from Inherited!
>
> Would someone care to comment what's going on here? To me this seems 
> like non-abstract aspects can be inherited from if a regular class is 
> as a mediator. Is this an intentional feature or is it something else? 
> I'm confused.
>
> Thanks,
>
> Panu.
>
> _______________________________________________
> 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