Skip to content

AspectC++

AspectC++ is an aspect-oriented extension of C and C++ languages. It has a source-to-source compiler, which translates AspectC++ source code into compilable C++. The compiler is available under the GNU GPL, though some extensions specific to Microsoft Windows are only available through pure-systems GmbH.

Aspect-oriented programming allows modularizing cross-cutting concerns in a single module, an aspect. Aspects can modify existing classes, but most commonly they provide 'advice' that runs before, after, or around existing functionality.

Example

All calls to a specific function can be traced using an aspect, rather than inserting 'cerr' or print statements in many places:

aspect Tracer
{ 
   advice call("% %Iter::Reset(...)") : before()
   {
      cerr << "about to call Iter::Reset for " << JoinPoint::signature() << endl;
   }
};

See also

Favorite site

References


  1. AOP(Aspect_Oriented_Programming)_and_aspect_C++.pdf