title: How do I imitate the Microsoft version of __FUNCTION__ using gcc?
body: <p>When I use the <code>__FUNCTION__</code> macro/variable to print out debugging information, there seems to be a difference in what it outputs when using the Microsoft C++ compiler and gcc. For example, using the following trivial code:</p>
  
  <pre><code>class Foo 
  {
      public:
         void Bar(int a, int b, int c)
         {
             printf ("__FUNCTION__ = %s\n", __FUNCTION__);
         }
  };
  
  int main (void)
  {
      Foo MyFoo;
  
      MyFoo.Bar();
  
      return 0;
  }
  </code></pre>
  
  <p>Using the Microsoft Visual C++ compiler, I get</p>
  
  <pre><code>__FUNCTION__ = Foo::Bar
  </code></pre>
  
  <p>whereas when compiling using gcc (in this case on the Mac), I get</p>
  
  <pre><code>__FUNCTION__ = Bar
  </code></pre>
  
  <p>The second example is not ideal because I quite often have several classes with, say, <code>Init()</code> and <code>Uninit()</code> methods and in a debug output trace its virtually impossible to tell which one of these has been called as the class name will be missing. Now, I know you can use the <code>__PRETTY_FUNCTION__</code> in place of <code>__FUNCTION__</code> to get something like</p>
  
  <pre><code>__PRETTY_FUNCTION__ = void Foo::Bar(int, int, int)
  </code></pre>
  
  <p>Which is fine, but its a bit too verbose for what I need and gets a bit long for functions with a lot of parameters. </p>
  
  <p>So my question is (at last), is there any way to get the output to look like simply <code>Foo::Bar</code> using gcc, as in the example above?</p>