title: Listing C/C++ functions (Code analysis in Unix)
body: <p>Whether we're maintaining unfamiliar code or checking out the implementation details of an Apache module it can help if we can quickly traverse the code and build up an overview of what we're looking at. Grep serves most of my daily needs but there are some cases where it just wont do.</p>
  
  <p>Here's a common example of how it can help. To find the definition of a PHP function I'm interested in I can type this at the command line:</p>
  
  <pre><code>grep -r "function myfunc" .
  </code></pre>
  
  <p>This could be adapted very quickly to C or C++ if we know the return type, but things become more complicated if, say, I want to list every method that my class provides:</p>
  
  <pre><code>grep "function " ./src/mine.class.php
  </code></pre>
  
  <p>Since there's no single keyword that denotes a function or method in C++ and because it's generally more complex syntax, I think I'd need some kind of static code analysis tool, smart use of the C Preprocessor or blind faith the coder followed strict code guidelines (# of whitespace, position of curlies etc) to get these sorts of results.</p>
  
  <p>What would you recommend?</p>