]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
doc: Move _Countof under 'Other Extensions to C Syntax'
authorAlejandro Colomar <alx@kernel.org>
Tue, 14 Oct 2025 14:41:29 +0000 (16:41 +0200)
committerSandra Loosemore <sloosemore@baylibre.com>
Thu, 6 Nov 2025 21:23:03 +0000 (21:23 +0000)
gcc/ChangeLog:

* doc/extend.texi: Move _Countof under 'Syntax Extensions'.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
gcc/doc/extend.texi

index 742782582064ca49b0ed75eef4edd5dffc33699f..a5b97f37d9d34a91d9c0fcba299d056e7004ba5d 100644 (file)
@@ -31,7 +31,6 @@ extensions, accepted by GCC in C90 mode and in C++.
 * Thread-Local::        Per-thread variables.
 * OpenMP::              Multiprocessing extensions.
 * OpenACC::             Extensions for offloading code to accelerator devices.
-* _Countof::            The number of elements of arrays.
 * Inline::              Defining inline functions (as fast as macros).
 * Volatiles::           What constitutes an access to a volatile object.
 * Using Assembly Language with C:: Instructions and extensions for interfacing C with assembler.
@@ -10890,36 +10889,6 @@ library.
 @xref{OpenMP and OpenACC Options}, for additional options useful with
 @option{-fopenacc}.
 
-@node _Countof
-@section Determining the Number of Elements of Arrays
-@cindex _Countof
-@cindex number of elements
-
-The keyword @code{_Countof} determines
-the number of elements of an array operand.
-Its syntax is similar to @code{sizeof}.
-The operand must be
-a parenthesized complete array type name
-or an expression of such a type.
-For example:
-
-@smallexample
-int a[n];
-_Countof (a);  // returns n
-_Countof (int [7][3]);  // returns 7
-@end smallexample
-
-The result of this operator is an integer constant expression,
-unless the array has a variable number of elements.
-The operand is only evaluated
-if the array has a variable number of elements.
-For example:
-
-@smallexample
-_Countof (int [7][n++]);  // integer constant expression
-_Countof (int [n++][7]);  // run-time value; n++ is evaluated
-@end smallexample
-
 @node Inline
 @section An Inline Function is As Fast As a Macro
 @cindex inline functions
@@ -13341,6 +13310,7 @@ C and/or C++ standards, while others remain specific to GNU C.
 * Labels as Values::    Getting pointers to labels, and computed gotos.
 * Nested Functions::    Nested functions in GNU C.
 * Typeof::              @code{typeof}: referring to the type of an expression.
+* _Countof::            Determining the number of elements of arrays
 * Offsetof::            Special syntax for @code{offsetof}.
 * Alignment::           Determining the alignment of a function, type or variable.
 * Enum Extensions::     Forward declarations and specifying the underlying type.
@@ -13977,6 +13947,36 @@ evaluated only once when using @code{__auto_type}, but twice if
 @code{typeof} is used.
 @end itemize
 
+@node _Countof
+@subsection Determining the Number of Elements of Arrays
+@findex _Countof
+@findex number of elements
+
+The keyword @code{_Countof} determines
+the number of elements of an array operand.
+Its syntax is similar to @code{sizeof}.
+The operand must be
+a parenthesized complete array type name
+or an expression of such a type.
+For example:
+
+@smallexample
+int a[n];
+_Countof (a);  // returns n
+_Countof (int [7][3]);  // returns 7
+@end smallexample
+
+The result of this operator is an integer constant expression,
+unless the array has a variable number of elements.
+The operand is only evaluated
+if the array has a variable number of elements.
+For example:
+
+@smallexample
+_Countof (int [7][n++]);  // integer constant expression
+_Countof (int [n++][7]);  // run-time value; n++ is evaluated
+@end smallexample
+
 @node Offsetof
 @subsection Support for @code{offsetof}
 @findex __builtin_offsetof