From: 0xCDCDCDCD@gmx.at   
      
   On 23.01.2012 04:12, Zeljko Vrba wrote:   
   > On 2012-01-22, Mathias Gaunard wrote:   
   >>   
   >> I frequently use find, grep, sed and perl to refactor C++ code. It's   
   >> powerful (I can express much more than 'rename a method'), fast, and   
   >> it scales to millions of line of code.   
   >>   
   >   
   > OK then. Please consider the code below, and write a script that will   
   > correctly rename file-scope function "A" in File1 to "C", as well as all   
   > calls to it from both files.   
   >   
   > // File1:   
   >   
   > int A(int x) { return -x; }   
   > ...   
   > template   
   > A F(A a, B b) { return A(a*b); }   
   >   
   > // File2:   
   >   
   > int A(int x);   
   > ...   
   >   
      
   I will chime in here and say that we always can construct cases where a   
   methodolgy breaks for C++. (I recommended VisualAssistX in another post, and I   
   am pretty sure that for a complex project with a situation like the one you   
   describe above, it would be    
   possible to construct cases where it fails.)   
      
   That does not mean that simple S&R, grep and stuff isn't usefule in 90% of all   
   refactoring cases, because, well, let's hope your code base is not really   
   filled with stuff named `A` or `B` or `do()`.   
      
   cheers,   
   Martin   
      
   --   
   Good C++ code is better than good C code, but   
   bad C++ can be much, much worse than bad C code.   
      
      
    [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
    [ comp.lang.c++.moderated. First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|