Problem. I got a code computing on an array. I am about to define a macro replacing every array reads with a function call. Here is an example:
For this code:
sum += a[i];
the micro should generate:
sum += function_call(a,i);
Current solution.
I found that I can replace a[i] with a(i) and use the following macro:
#define a(i) function_call(a,i)
However, I prefer not to modify the original code. I just want to add macros.
Question. Can I achieve this with a clever macro definition? Any idea is highly appreciated.
Notice: I have to use C syntax.