Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>From section 7.1.3 paragraph 2 of n1570 (which is a draft of C1x):</p> <blockquote> <p>No other identifiers are reserved.</p> </blockquote> <p>This is the part that means <code>getline</code> shouldn't be defined by the <code>&lt;stdio.h&gt;</code>, since it's not a reserved identifier according to the spec. So if your library defines <code>getline</code> in <code>&lt;stdio.h&gt;</code>, it's not technically compliant with the C standard...</p> <p>However, you <em>should</em> be able to use the feature test macros to cause <code>getline</code> to be undefined in <code>&lt;stdio.h&gt;</code>.</p> <pre><code>#undef _POSIX_C_SOURCE #define _POSIX_C_SOURCE 200112L #include &lt;stdio.h&gt; </code></pre> <p>This will give you only the definitions from the older POSIX standards. This won't work on some GNU C++ implementations, which is <strong>ExTrEmeLY fruSTRaTiNG</strong> for some folks.</p> <p>The relevant section of the manpage is (taken from a glibc manpage, sorry...)</p> <pre> Feature Test Macro Requirements for glibc (see feature_test_macros(7)): getline(), getdelim(): Since glibc 2.10: _POSIX_C_SOURCE >= 200809L || _XOPEN_SOURCE >= 700 Before glibc 2.10: _GNU_SOURCE </pre> <p>This part of the manpage tells you which macros need to be defined to which values in order to get the definition. My bet is that <code>_POSIX_C_SOURCE</code> is already defined by your compiler to <code>200809L</code>.</p> <p>The idea of feature test macros is that if you define your macros, like <code>_POSIX_C_SOURCE</code>, <code>_BSD_SOURCE</code>, <code>_XOPEN_SOURCE</code>, etc. to the values you want, you won't need to worry about new library functions clashing with your existing functions. There is also <code>_GNU_SOURCE</code>, which turns <em>everything</em> on if you use glibc, but I suggest giving that macro a wide berth.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload