title: Removing null warnings in Splint
body: <p>I have been trying out <a href="http://www.splint.org/" rel="nofollow noreferrer">Splint</a> with a C program I recently wrote and trying to understand and remove the warnings it gives. One I understand but can't understand how to remove it comes from the following code snippet:</p>
  
  <pre><code>static MyType_t *findById(const int id)
  {
      int i;
  
      for (i = 0; i &lt; MY_ARR_SIZE; i++) {
              if (my_arr[i].id == NOT_SET) {
                      /* Items are sorted so that items with 
                      NOT_SET as ID are at the end of the array */
                      break;
              }
              if (my_arr[i].id == id) {
                      return &amp;(my_arr[i]);
              }
      }
      return NULL; 
  }
  </code></pre>
  
  <p>Splint isn't happy that the function can return NULL, but in this case it makes perfect sense. </p>
  
  <p>I tried using /<em>@nullwhenfalse@</em>/ but it seems to only work if the function returns true/false and also tried to change the code to use a retVal and tried both /<em>@null@</em>/ and /<em>@relnull@</em>/ in front of the declaration, but these did nothing. </p>
  
  <p>(Just as a side-note, the table is only 20 big atm, so no point in using a clever search algorithm.)</p>