Community
Participate
Working Groups
Eclipse IDE for C/C++ Developers Version: Kepler Service Release 1 Build id: 20130919-0819 Reproducing the bug: Consider the following code: ============== Original Version =============== #define C =3; int main(int a, char** argv) { int b C // Macro to be extracted printf ("%d\n",b); return 0; } =============================================== After applying the refactoring, we have the resulting code: ============= Refactored Version ============== #define C =3; int main(int a, char** argv) { int i = C; // Extracted macro int b i printf ("%d\n",b); return 0; } =============================================== When expanding the macro C, the extracted line will result in "int i = =3" (syntax error). I believe it's tricky to check constraints of a transformation when there's a macro involved, since its semantics is unknown (in this case, it is an assignment but it could be a constant, a function, and so on). However, an option could be a warning to the user about the resulting transformation ("Am I aware of what I'm trying to do?"). Another option could be even trying to check if the macro definition won't cause problems in the transformation. Thanks in advance.
* by constant, I was actually saying "literal value" Sorry about that.