This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

inline \ MACROs

Hi,
I want to avoid the CALL \ RET overhead of a certain function which is called only once in my program.

I understand the uVision compiler does not support the inline keyword (http://www.keil.com/support/docs/1755.htm), and I should use macros instead.
The problem is that uVision cannot step into macros when debugging.

Is there any good solution for this problem?

Parents Reply Children
  • If for some reason you can't live with #define'ing the macro, there's the brutally ugly #include method for inlining:

    MyMacro.i
    --
       // I have no idea what the real code is doing
       // so here's some random small calculation
       i >>= 1;
       i++;
    --
    
    Caller.c
    --
       for (i = 0; i < A_BAZILLION; ++i)
          {
    #include "MyMacro.i"
          }
    --
    

    The debugger should be able to step into this code. The definition exists in only one place for maintenance.