[aspectc-user] Weaving question

Francisco Afonso afonsofc at hotmail.com
Tue Sep 27 11:19:38 CEST 2005


I wrote some days ago a Logging aspect and it is working fine, but 
frequently I have to monitor variables and class instances inside a method 
or function. For this I wrote a nop(...) function in the base code that 
would be called inside my methods with different number and types of 
arguments. As it did not work, I wrote this simple test program to show what 
I am trying to do.

//----------- main.cc ----------------------------------
#include <stdio.h>

void nop(...){};

class MyClass {

   int doit ( int aa ) {
     int bb;

     bb = aa * 5;


     return (bb + 2);

int main() {

  MyClass mine;



// ---------- nop.ah ----------------------------
#include <stdio.h>

aspect myAspect {

   pointcut log (int zz) = args(zz) && call ("void nop(...)");

    advice log (zz) : before(int zz)  {

      printf("The local value is %d \n", zz);



The ac++ program does not generate a call to the advice code at the 
"nop(bb)" in main. Why ? Doesn't it conform with the pointcut definition ?


More information about the aspectc-user mailing list