C++ – Removing macro in legacy code


I have a lot of legacy code using macro of the form:

#define FXX(x) pField->GetValue(x)

The macro forces variable pField be in the scope:

FIELD *pField = ....
int i = FXX(3);
int j = FXX(5);

Is there way to replace the macro, without touching user code?

Since FXX(x) has a function invocation style, I thought about inline function or something similar.

People just used to the macro, and I want to remain it as is.

Best Solution

How about using a find & replace function in your favorite editor...I think it would work fine in the example you gave in your question. Replace FXX with pField->GetValue and then remove the #define line