title: c strptime warning comparison between pointer and integer
body: <p>Compiling with gcc 4.4.3 on Ubuntu 10.04.2 x86_64 I get the following warning:</p>
  
  <pre><code>warning: comparison between pointer and integer
  </code></pre>
  
  <p>for this line:</p>
  
  <pre><code>if (strptime(date_time, "%d-%b-%y %T", &amp;tm) == NULL) {
  </code></pre>
  
  <p>If I change NULL to 0 the warning goes away. But the man page for strptime states that it returns NULL on error. I am including <code>&lt;time.h&gt;</code> with <code>#define __USE_XOPEN 1</code> on the previous line. I have also tried <code>#define _XOPEN_SOURCE</code>.</p>
  
  <p>Thank you for your time.</p>
  
  <p>EDIT</p>
  
  <p>The full includes:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  #include &lt;pthread.h&gt;
  
  #define __USE_XOPEN 1 /* needed for strptime */
  #include &lt;time.h&gt;
  
  #include &lt;arpa/inet.h&gt;
  #include &lt;errno.h&gt;
  
  #include "recv.h"
  #include "tcp.h"
  #include "types.h"
  </code></pre>
  
  <p>EDIT</p>
  
  <p>The following code gives the same warning:</p>
  
  <pre><code>#define __USE_XOPEN 1 /* needed for strptime */
  #include &lt;time.h&gt;
  
  #include &lt;stdio.h&gt;
  
  int main()
  {
      struct tm tm;
      char date_time[] = "3-May-11 12:49:00";
  
      if (strptime(date_time, "%d-%b-%y %T", &amp;tm) == NULL) {
          fprintf(stderr, "Error: strptime failed matching input\n");
      }
  
      return 0;
  }
  </code></pre>
  
  <p>EDIT EDIT</p>
  
  <p>But changing it to _XOPEN_SOURCE worked! And moving the define to the top of the program fixed the original.</p>