title: Warning 'return' with no value, in function returning non-void - What should it return?
body: <p>How do I solve the following throwing the warning in the title?</p>
  
  <pre><code>struct Nodes* InsertNode(unsigned int IP, unsigned short Port)
  {
      if (!IP)
         return;
      if (!Port)
         return;
      // Above is what chucks the warnings
      {
          // do stuff &amp; conditionally
             return &amp;List[x];
      }
      // Different conditions &amp; stuff
      {
         return &amp;List[Other];
      }
  }
  </code></pre>
  
  <p>In other words, in the case of giving up through missing data, what should it return?  Or do I need to trawl through the entire body of code and have checks every time to see if it should be called or not?  The program functions as intended just returning at that point, if I'm to continue using it (or upgrade the OS it's running on), fixing compiler warnings seems like a good idea, they tend to turn into errors when compiler versions get bumped.</p>
  
  <p>There's a clue in <a href="https://stackoverflow.com/a/2422651">this answer</a> which answers someone asking about the same warning, the answer doesn't give me quite enough info to proceed though, nor do the other's I've read.</p>
  
  <p>Extra information: The check on the values of <strong>IP</strong> &amp; <strong>Port</strong> are there to sanitize the content of <strong>&amp;List</strong>, such cases indicate datagrams from misconfigured clients or traffic from persons with malicious intent, sad but it happens. It's invalid data we don't care about <em>at all</em>, logging it seems pointless, it shouldn't delay processing the next one, and absolutely not halt the program. Until the switch from gcc 4.9 to 6.3 I didn't see a warning. The current <strong>return;</strong> <em>appears</em> to simply black-hole it, but I only understand bits of the code's intent.</p>