summaryrefslogtreecommitdiff
path: root/devdocs/c/string%2Fbyte%2Fmemcmp.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2025-08-14 22:58:58 -0500
committerCraig Jennings <c@cjennings.net>2025-08-14 22:58:58 -0500
commit82ba818ff456bcd6d56a06226e3f27e98fbb55c3 (patch)
tree158cfc17b2f644a10f063cb546752cfaae12c97f /devdocs/c/string%2Fbyte%2Fmemcmp.html
parent9278ddd4ea1a8b1a4c1edaa8894516e3f48d245b (diff)
downloaddotemacs-82ba818ff456bcd6d56a06226e3f27e98fbb55c3.tar.gz
dotemacs-82ba818ff456bcd6d56a06226e3f27e98fbb55c3.zip
removing all downloaded devdocs files
Diffstat (limited to 'devdocs/c/string%2Fbyte%2Fmemcmp.html')
-rw-r--r--devdocs/c/string%2Fbyte%2Fmemcmp.html57
1 files changed, 0 insertions, 57 deletions
diff --git a/devdocs/c/string%2Fbyte%2Fmemcmp.html b/devdocs/c/string%2Fbyte%2Fmemcmp.html
deleted file mode 100644
index 4d8d372f..00000000
--- a/devdocs/c/string%2Fbyte%2Fmemcmp.html
+++ /dev/null
@@ -1,57 +0,0 @@
- <h1 id="firstHeading" class="firstHeading">memcmp</h1> <table class="t-dcl-begin"> <tr class="t-dsc-header"> <th> Defined in header <code>&lt;string.h&gt;</code> </th> <th> </th> <th> </th> </tr> <tr class="t-dcl"> <td class="t-dcl-nopad"> <pre data-language="c">int memcmp( const void* lhs, const void* rhs, size_t count );</pre>
-</td> <td class="t-dcl-nopad"> </td> <td class="t-dcl-nopad"> </td> </tr> </table> <p>Compares the first <code>count</code> bytes of the objects pointed to by <code>lhs</code> and <code>rhs</code>. The comparison is done lexicographically.</p>
-<p>The sign of the result is the sign of the difference between the values of the first pair of bytes (both interpreted as <code>unsigned char</code>) that differ in the objects being compared.</p>
-<p>The behavior is undefined if access occurs beyond the end of either object pointed to by <code>lhs</code> and <code>rhs</code>. The behavior is undefined if either <code>lhs</code> or <code>rhs</code> is a null pointer.</p>
-<h3 id="Parameters"> Parameters</h3> <table class="t-par-begin"> <tr class="t-par"> <td> lhs, rhs </td> <td> - </td> <td> pointers to the objects to compare </td>
-</tr> <tr class="t-par"> <td> count </td> <td> - </td> <td> number of bytes to examine </td>
-</tr>
-</table> <h3 id="Return_value"> Return value</h3> <p>Negative value if <code>lhs</code> appears before <code>rhs</code> in lexicographical order.</p>
-<p>Zero if <code>lhs</code> and <code>rhs</code> compare equal, or if count is zero.</p>
-<p>Positive value if <code>lhs</code> appears after <code>rhs</code> in lexicographical order.</p>
-<h3 id="Notes"> Notes</h3> <p>This function reads <a href="../../language/object" title="c/language/object">object representations</a>, not the object values, and is typically meaningful for byte arrays only: structs may have padding bytes whose values are indeterminate, the values of any bytes beyond the last stored member in a union are indeterminate, and a type may have two or more representations for the same value (different encodings for +0 and -0 or for +0.0 and –0.0, indeterminate padding bits within the type).</p>
-<h3 id="Example"> Example</h3> <div class="t-example"> <div class="c source-c"><pre data-language="c">#include &lt;stdio.h&gt;
-#include &lt;string.h&gt;
-
-void demo(const char* lhs, const char* rhs, size_t sz)
-{
- for(size_t n = 0; n &lt; sz; ++n)
- putchar(lhs[n]);
-
- int rc = memcmp(lhs, rhs, sz);
- const char *rel = rc &lt; 0 ? " precedes " : rc &gt; 0 ? " follows " : " compares equal ";
- fputs(rel, stdout);
-
- for(size_t n = 0; n &lt; sz; ++n)
- putchar(rhs[n]);
- puts(" in lexicographical order");
-}
-
-int main(void)
-{
- char a1[] = {'a','b','c'};
- char a2[sizeof a1] = {'a','b','d'};
-
- demo(a1, a2, sizeof a1);
- demo(a2, a1, sizeof a1);
- demo(a1, a1, sizeof a1);
-}</pre></div> <p>Output:</p>
-<div class="text source-text"><pre data-language="c">abc precedes abd in lexicographical order
-abd follows abc in lexicographical order
-abc compares equal to abc in lexicographical order</pre></div> </div> <h3 id="References"> References</h3> <ul>
-<li> C17 standard (ISO/IEC 9899:2018): </li>
-<ul><li> 7.24.4.1 The memcmp function (p: 266) </li></ul>
-<li> C11 standard (ISO/IEC 9899:2011): </li>
-<ul><li> 7.24.4.1 The memcmp function (p: 365) </li></ul>
-<li> C99 standard (ISO/IEC 9899:1999): </li>
-<ul><li> 7.21.4.1 The memcmp function (p: 328) </li></ul>
-<li> C89/C90 standard (ISO/IEC 9899:1990): </li>
-<ul><li> 4.11.4.1 The memcmp function </li></ul>
-</ul> <h3 id="See_also"> See also</h3> <table class="t-dsc-begin"> <tr class="t-dsc"> <td> <div><a href="strcmp" title="c/string/byte/strcmp"> <span class="t-lines"><span>strcmp</span></span></a></div> </td> <td> compares two strings <br> <span class="t-mark">(function)</span> </td>
-</tr> <tr class="t-dsc"> <td> <div><a href="strncmp" title="c/string/byte/strncmp"> <span class="t-lines"><span>strncmp</span></span></a></div> </td> <td> compares a certain amount of characters of two strings <br> <span class="t-mark">(function)</span> </td>
-</tr> <tr class="t-dsc"> <td colspan="2"> <span><a href="https://en.cppreference.com/w/cpp/string/byte/memcmp" title="cpp/string/byte/memcmp">C++ documentation</a></span> for <code>memcmp</code> </td>
-</tr> </table> <div class="_attribution">
- <p class="_attribution-p">
- &copy; cppreference.com<br>Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.<br>
- <a href="https://en.cppreference.com/w/c/string/byte/memcmp" class="_attribution-link">https://en.cppreference.com/w/c/string/byte/memcmp</a>
- </p>
-</div>