]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
man/man3/countof.3: Add page
authorAlejandro Colomar <alx@kernel.org>
Sat, 26 Jul 2025 21:03:03 +0000 (23:03 +0200)
committerAlejandro Colomar <alx@kernel.org>
Tue, 19 Aug 2025 11:13:55 +0000 (13:13 +0200)
Link: <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3550.pdf#subsubsection.0.6.5.4.5>
Link: <https://thephd.dev/the-big-array-size-survey-for-c>
Link: <https://thephd.dev/the-big-array-size-survey-for-c-results>
Link: <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117025>
Link: <https://github.com/llvm/llvm-project/issues/102836>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
man/man3/countof.3 [new file with mode: 0644]

diff --git a/man/man3/countof.3 b/man/man3/countof.3
new file mode 100644 (file)
index 0000000..4de30cb
--- /dev/null
@@ -0,0 +1,35 @@
+.\" Copyright, the authors of the Linux man-pages project
+.\"
+.\" SPDX-License-Identifier: Linux-man-pages-copyleft
+.\"
+.TH countof 3 (date) "Linux man-pages (unreleased)"
+.SH NAME
+countof, _Countof \- count the number of elements in an array
+.SH LIBRARY
+Standard C library
+.RI ( libc )
+.SH SYNOPSIS
+.nf
+.B #include <stdcountof.h>
+.P
+.BI "size_t countof(" array );
+.fi
+.SH DESCRIPTION
+This operator counts the number of elements in an array.
+.P
+If the operand is not an array,
+it produces a compilation error.
+.P
+There's a keyword,
+.BR \%_Countof (),
+that behaves identically,
+and can be used without including
+.IR <stdcountof.h> .
+.SH RETURN VALUE
+The number of elements in the array.
+.SH STANDARDS
+C2y.
+.SH HISTORY
+gcc 16, clang 21.
+.SH SEE ALSO
+.BR operator (7)