mirror of
https://github.com/python/cpython.git
synced 2025-12-23 09:19:18 +00:00
[3.14] gh-141004: Document Py_ARRAY_LENGTH (GH-141601) (GH-141895)
gh-141004: Document `Py_ARRAY_LENGTH` (GH-141601)
(cherry picked from commit e0773eacb7)
Co-authored-by: Yashraj <yashrajpala8@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
This commit is contained in:
parent
6511eb0f06
commit
17c5d6d58d
1 changed files with 13 additions and 0 deletions
|
|
@ -322,6 +322,19 @@ complete listing.
|
|||
PyDoc_VAR(python_doc) = PyDoc_STR("A genus of constricting snakes in the Pythonidae family native "
|
||||
"to the tropics and subtropics of the Eastern Hemisphere.");
|
||||
|
||||
.. c:macro:: Py_ARRAY_LENGTH(array)
|
||||
|
||||
Compute the length of a statically allocated C array at compile time.
|
||||
|
||||
The *array* argument must be a C array with a size known at compile time.
|
||||
Passing an array with an unknown size, such as a heap-allocated array,
|
||||
will result in a compilation error on some compilers, or otherwise produce
|
||||
incorrect results.
|
||||
|
||||
This is roughly equivalent to::
|
||||
|
||||
sizeof(array) / sizeof((array)[0])
|
||||
|
||||
|
||||
.. _api-objects:
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue