We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
If one macro is defined for "assignment": Ex. #define equal(a,b) {a=b; }
And write: equal(A,1); equal(A,2); equal(A,3);
where A is pointer to XDATA space(mapped to H/W)
Keil C will "optimize" them and final result is A=3 ? or Keil C won't do this and expand them one by one ?
Thanks in advance...
They did not respond with opinions, but with facts.
Another thing - a #define named equal(a,b) should really represent a comparison - (is a equal to b?).
If you want your define to assign values, you should call it assign(a,b). Now, this was an opinion - never use confusing names for variables, defines, functions, ...
But as already mentioned, the preprocessor is really a preprocessor (even if implemented inside the compiler) doing text-based search/replace in your source code before the compiler starts to decide what the code looks like and starts with optimizations/code generation.
Thanks for all the facts you provided ^o^