776c7f35   
   From: mordor.nospam@fly.srk.fer.hr   
      
   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; }   
   int B(int y) { return y*3; }   
      
   template   
   A F(A a, B b) { return A(a*b); }   
      
   // File2:   
      
   int A(int x);   
      
   namespace   
   {   
      
   struct B   
   {   
    B() : A(0) { }   
    int A;   
   };   
      
   struct X   
   {   
    X(int z) : Z(A(z)) {}   
    int Z;   
   };   
      
   }   
      
      
   --   
    [ 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)   
|