FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-141004: Document Py_ARRAY_LENGTH macro by Yashp002 · Pull Request #141601 · python/cpython · GitHub

/ cpython Public
13 changes: 13 additions & 0 deletions Doc/c-api/intro.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
Loading

Back | FazBrowse Home | New Git URL