WCWIDTH(3POSIX)

πŸŽ€ WCWIDTH(3POSIX) β€” the POSIX Programmer's Manual, bestie edition πŸŽ€

okay so first things first, this is WCWIDTH(3POSIX) from the POSIX Programmer's Manual, and I'm about to tell you everything about it πŸ’…


✨ PROLOG ✨ (yes it's giving fine print, but read it)

okay so this manual page is part of the POSIX Programmer's Manual. That's the whole vibe.

🫢 heads up bestie: the Linux implementation of this interface may differ (so like, go consult the corresponding Linux manual page for details on Linux behavior), OR the interface may not be implemented on Linux at all. no cap, that's just how it is.

🌸 NAME 🌸

wcwidth β€” number of column positions of a wide-character code. that's it, that's the whole job πŸ’–


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <wchar.h>

int wcwidth(wchar_t wc);

look at her. short, sweet, iconic. πŸ‘‘


πŸ’œ DESCRIPTION πŸ’œ

okay so the wcwidth() function shall determine the number of column positions required for the wide character wc. that's the mission, that's the assignment, and she ate. πŸ’…

and the application shall ensure that the value of wc is a character representable as a wchar_t, and is a wide-character code corresponding to a valid character in the current locale. so like… make sure you're feeding her something valid, or that's on you, not her πŸ™ˆ


🌈 RETURN VALUE 🌈

the wcwidth() function shall either:

  • return 0 β€” if wc is a null wide-character code 🫧
  • return the number of column positions to be occupied by the wide-character code wc πŸ“
  • return -1 β€” if wc does not correspond to a printable wide-character code πŸ’€

three options, three moods, she contains multitudes. ⭐


πŸ’€ ERRORS πŸ’€

No errors are defined. nothing to report, no drama, we're chill. 😌

and also, the following sections are informative β€” so like, they're the vibes, not the law. iykyk 🧚


πŸ“ EXAMPLES πŸ“

None. literally none. she said "figure it out" and honestly? respect. πŸ™ˆ


πŸ”₯ APPLICATION USAGE πŸ”₯

okay this part is actually important so listen up bestie:

this function was removed from the final ISO/IEC 9899:1990/Amendment 1:1995 (E), and the return value for a non-printable wide character is not specified.

😭 not me telling you the return value for a non-printable wide character is literally unspecified. it's giving undefined behavior energy. be careful out there.

πŸ‘‘ RATIONALE πŸ‘‘

None. no reasoning provided, she simply is. main character energy, no explanation needed. πŸ’…


🧚 FUTURE DIRECTIONS 🧚

None. the future is unwritten and also empty. slay. ✨


πŸ’– SEE ALSO πŸ’–

  • wcswidth() β€” her sister, go say hi 🫢
  • the Base Definitions volume of POSIX.1‐2017, and <wchar.h> πŸ“š

okay so legally I have to tell you this, and I'm gonna tell you it exactly:

Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .


and that's the whole page bestie!! πŸŽ€ she's from IEEE/The Open Group, 2017 β€” so this iconic little man page is dated 2017, published under WCWIDTH(3POSIX), and I am obsessed with her. go forth and measure your column positions. periodt. πŸ’–βœ¨πŸ¦‹