wmemcmp(3)
π wmemcmp β bestie edition π
okay so listen. this is wmemcmp from the wmemcmp(3) manual page, and she is the wide-character glow-up of memcmp(3). no cap. let's get into it π¦
β¨ NAME β¨
wmemcmp β compare two arrays of wide-characters πΈ
π LIBRARY π
Standard C library (libc, -lc) β the classic, the icon, the one that's already on your machine π
π SYNOPSIS π
#include <wchar.h>
int wmemcmp(size_t n;
const wchar_t s1[n], const wchar_t s2[n], size_t n);
yes bestie that is literally the whole thing. she's compact. she knows what she is. π
π« DESCRIPTION π«
so wmemcmp() is the wide-character equivalent of the memcmp(3) function β like, same energy, but for wide chars instead of plain bytes. π§
what she actually does: she compares the n wide-characters starting at s1 against the n wide-characters starting at s2. that's it. that's the job. and she does it well. π₯
π«Ά RETURN VALUE π«Ά
here's the vibe check results, and you need to know these:
- she returns zero if the wide-character arrays of size
nats1ands2are equal. happy ending, besties are matching π - she returns an integer greater than zero if, at the first differing position
i(wherei < n), the corresponding wide-characters1[i]is greater thans2[i]. sos1[i] > s2[i], she wins, main character energy π - she returns an integer less than zero if, at the first differing position
i(wherei < n), the corresponding wide-characters1[i]is less thans2[i]. sos1[i] < s2[i], she's giving soft launch π
note the i < n in both of those β the difference has to actually happen inside your array. that's the whole point. periodt.
π ATTRIBUTES π
for an explanation of the terms used in this section, go peek at attributes(7) β she explains the vocabulary, i just deliver the gossip π
- Interface:
wmemcmp()β Attribute: Thread safety β Value: MT-Safe β¨
so yeah. multiple threads can call her at the same time and everything stays cute. MT-Safe, no drama, no data races, we love to see it π
β STANDARDS β
C11, POSIX.1-2008. officially official. certified. π
π°οΈ HISTORY π°οΈ
she came through in POSIX.1-2001 and C99. an elder icon who has been serving since the early 2000s π
π SEE ALSO π
memcmp(3)β the byte-level original, her inspiration π«wcscmp(3)β the null-terminated cousin, different personality, also iconic π¦
πΈ cutie sign-off πΈ
this lil page came from Linux man-pages 6.20, dated 2026-02-08, and it's the wmemcmp(3) entry babes π go forth, compare your wide-characters, stay MT-Safe, and remember: zero means equal, and equal means slay π
β¨
π¦ where this page comes from
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- π the page's license: GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms