UUID_COMPARE(3)

πŸ’… UUID_COMPARE(3) β€” the libuuid girlies' comparison era

okay bestie, so this is a page from the Programmers Manual and it's literally about uuid_compare, which β€” true story β€” is the function that tells you whether two UUIDs are the same. tiny function, huge main character energy. let's get into it πŸŽ€


✨ NAME ✨

uuid_compare β€” compare whether two UUIDs are the same πŸ¦‹


🌸 SYNOPSIS 🌸

#include <uuid.h>

int uuid_compare(const uuid_t uu1, const uuid_t uu2)

like, that's it. that's the whole vibe. two UUIDs go in, a number comes out. no cap πŸ’…


πŸ’– DESCRIPTION πŸ’–

The uuid_compare() function compares the two supplied uuid variables uu1 and uu2 to each other. literally just the two of them, side by side, having a little moment. that's the entire job and it does it slayfully ✨


πŸ”₯ RETURN VALUE πŸ”₯

It returns an integer that's less than, equal to, or greater than zero β€” and here's the chart bestie, memorize it iykyk:

  • less than zero β†’ uu1 is lexicographically less than uu2
  • equal to zero β†’ uu1 is equal to uu2
  • greater than zero β†’ uu1 is lexicographically greater than uu2

so like, it's giving comparison-function, not just a yes/no. mind the lexicographically tho, it's doing real work there πŸ‘‘


πŸ‘‘ AUTHORS πŸ‘‘

Theodore Y. Ts'o 🫢 (icon behavior, honestly)


🌈 SEE ALSO 🌈

the whole friend group, fr fr:


⭐ AVAILABILITY ⭐

The libuuid library is part of the util-linux package since version 2.15.1. It can be downloaded from the Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/> β€” go get your girl, she's right there 🧚


⚠️ real talk though: this one's just a comparison. no NULL warnings, no undefined behavior drama on this page β€” but always read the return value properly, because 0 means equal, not error, and that trips people up constantly πŸ’€

and that's the whole page, bestie!! πŸ“ this lil handbook moment was brought to you by util-linux 2.41.6, dated 2026-08-31 β€” mwah, go compare some UUIDs πŸ’œπŸŽ€

πŸ“¦ where this page comes from