title: Why does strerror_r behave differently when compiled with gnu90 and c90 standards?
body: <p>Here is my program.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;errno.h&gt;
  
  int main()
  {
          char errbuf[256];
  
          errno = 0;
          strtoul("99999999999999999999999999999999999999999999", NULL, 0);
          strerror_r(errno, errbuf, sizeof errbuf);
          printf("strerror_r: %s\n", errbuf);
  
      return 0;
  }
  </code></pre>
  
  <p>When I compile it with <code>-std=gnu90</code> or <code>-std=gnu99</code>, I get the expected output.</p>
  
  <pre><code>susam@nifty:~/lab/linux$ rm -f a.out &amp;&amp; gcc -std=gnu90 -Wall -Wextra -pedantic foo.c &amp;&amp; ./a.out 
  strerror_r: Numerical result out of range
  susam@nifty:~/lab/linux$ rm -f a.out &amp;&amp; gcc -std=gnu99 -Wall -Wextra -pedantic foo.c &amp;&amp; ./a.out 
  strerror_r: Numerical result out of range
  </code></pre>
  
  <p>But when I compile it with <code>-std=c90</code> or <code>-std=c99</code>, I get a warning and I don't see <code>strerror_r</code> putting the string in <code>errbuf</code>.</p>
  
  <pre><code>lone@debian:~/lab/linux$ rm -f a.out &amp;&amp; gcc -std=c90 -Wall -Wextra -pedantic foo.c &amp;&amp; ./a.out
  foo.c: In function ‘main’:
  foo.c:12:2: warning: implicit declaration of function ‘strerror_r’ [-Wimplicit-function-declaration]
    strerror_r(errno, errbuf, sizeof errbuf);
    ^
  strerror_r:
  lone@debian:~/lab/linux$ rm -f a.out &amp;&amp; gcc -std=c99 -Wall -Wextra -pedantic foo.c &amp;&amp; ./a.out
  foo.c: In function ‘main’:
  foo.c:12:2: warning: implicit declaration of function ‘strerror_r’ [-Wimplicit-function-declaration]
    strerror_r(errno, errbuf, sizeof errbuf);
    ^
  strerror_r:
  </code></pre>
  
  <p>What is going wrong when I use <code>-std=c90</code> or <code>-std=c99</code>?</p>