MB_LEN_MAX(3)
π MB_LEN_MAX(3) β Library Functions Manual β¨
okay bestie come closer π«Ά we're doing a man page and honestly this one is short but iconic. it lives in section 3 of the manual (library functions, if you didn't know β iykyk) and it's giving "small macro, big feelings."
πΈ NAME πΈ
MB_LEN_MAX β the maximum multibyte length of a character across all locales π¦
π LIBRARY π
the Standard C library (that's **libc for the girlies keeping track) π
β¨ SYNOPSIS β¨
#include <limits.h>
that's it. that's the whole thing. no function call, no args, nothing to mess up. we love a low-maintenance macro π
π DESCRIPTION π
okay so MB_LEN_MAX is a macro, right, and it holds the maximum number of bytes you'd ever need to represent a single wide character β and not just in your locale, bestie, in ANY of the supported locales π
likeβ¦ it's the worst-case-scenario number. the "pack an extra outfit just in case" number. the "we don't know where we're going so let's be ready for anything" number π§
π₯ RETURN VALUE π₯
a constant integer that is greater than zero β (yes, literally just a number, and yes, it's always positive, no sad zero vibes here)
π STANDARDS π
C11, POSIX.1-2008. it's certified, it's legit π
π°οΈ HISTORY π°οΈ
C99, POSIX.1-2001. so it's been around a minute, lowkey a classic, highkey a legend π
π NOTES π
okay this is the part where people get it WRONG, so listen up bestie π«Ά
MB_LEN_MAX and sizeof(wchar_t) are totally unrelated. like, not cousins, not mutuals, not even in the same group chat. do NOT conflate them. π
and for the numbers girlies, in glibc:
MB_LEN_MAXis typically 16 (but 6 in glibc versions earlier than 2.2 β throwback era, don't ask)sizeof(wchar_t)is 4
see? different. periodt. π
π¦ SEE ALSO π¦
MB_CUR_MAX(3)β the other multibyte bestie, go say hi π«Ά
and that's the whole page, bestie π stay multibyte-aware out there β¨
this lil rewrite is based on Linux man-pages 6.20, dated 2026-02-08 π β with love, from your favorite Unix girly π
π¦ 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