title: How to properly comment
body: <p>This is a very simple question which I am surprised I haven't found anywhere else on SO. I was wondering <em>which comments should or shall not be in header/source files</em> and even, because some languages don't really use the header/source system, <em>what is the proper way to comment</em>.</p>
  <p>So far I have been doing it like that :</p>
  <p><strong>main.c or main.cpp</strong></p>
  <pre><code>int main()
  {
      // Comments to describe what happens in main
  }
  </code></pre>
  <p><strong>foo.h</strong></p>
  <pre><code> // Comments for documentation and which gives information about the function itself
  
  /**
  * \fn void aFunction(void)
  * \brief This function is a function
  */
  void aFunction(void);
  </code></pre>
  <p><strong>foo.c or foo.cpp</strong></p>
  <pre><code>void aFunction(void)
  {
      // Comments to describe and explain what happens within this function
  }
  </code></pre>
  <ul>
  <li>Not much comments in main, just describing basically <strong>what functions are called and why</strong></li>
  <li>In header, only comments to describe <strong>the function itself</strong>; parameters, brief, return etc.</li>
  <li>In source, only comments to describe <strong>what's happening within the function</strong>; loops, condition, etc.</li>
  </ul>
  <p>That is what I know for sure. Are there more comments needed in either main, source or header ? Should I add the comments I usually only put in the header in the source too, like that :</p>
  <p><strong>foo.c or foo.cpp</strong></p>
  <pre><code>/**
  * \fn void aFunction(void)
  * \brief This function is a function
  */
  void aFunction(void)
  {
      // Comments to describe and explain what happens within this function
  }
  </code></pre>
  <p>I know this may sound subjective, but it is an obvious fact that some devs are better at commenting than others, and thus that there are good and bad ways to comment.</p>