__ARRAYCOUNT(3)
π¦ __ARRAYCOUNT(3) β like, the whole vibe π¦
okay so this is a page from the Library Functions Manual (iykyk, that's the manual name, bestie) and honestly? it's a tiny little macro that eats π
πΈ NAME πΈ
__arraycount β the macro for statically allocated arrays β¨
π SYNOPSIS π
#include <sys/cdefs.h>
size_t
__arraycount(x);
π DESCRIPTION π
okay so here's the tea β β the __arraycount() macro literally just returns the number of elements in a statically allocated buffer. that's it. that's the whole function. no cap. it's giving "small but mighty" energy fr fr π
π EXAMPLES π
this is the part where it gets iconic β here's a typical usage of __arraycount(), bestie:
uint8_t buf[BUFSIZE];
size_t i;
...
for (i = 0; i < __arraycount(buf); i++)
...
see how it just knows how many things are in buf? main character behavior honestly ππ
π₯ SEE ALSO π₯
cdefs(3)β go read this one too, it's the whole squad π«Ά
β HISTORY β
the __arraycount() macro first appeared in NetBSD 4.0 β a true OG, been slaying since day one πβ¨
π reminder bestie: it only works on statically allocated arrays. don't try to be cute with it elsewhere, k? π
and that's a wrap! this lil icon comes from the Debian build of the page, dated December 16, 2010, and yep β it's still filed under __ARRAYCOUNT(3) in the manual. mwah πβ¨
π¦ where this page comes from
- nixpkgs unstable: netbsd-source 11.0
- Copyright (c) 2010 The NetBSD Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms