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_MAX is 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