-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
gh-141004: Document Py_ARRAY_LENGTH macro #141601
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
7c24a14
3813ae8
40acd8f
4234c8b
8191b69
f3a7fb7
0301587
7f64d0b
7962258
f27366a
8a9fc39
2aadd23
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -303,6 +303,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 (number of elements) of a statically allocated C array at | ||
| compile time. | ||
|
|
||
| The *array* argument must be a C array with a size known at compile time, | ||
| not a pointer. Using this macro with a pointer will produce incorrect results. | ||
Yashp002 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| This is generally equivalent to:: | ||
|
||
|
|
||
| sizeof(array) / sizeof((array)[0]) | ||
|
|
||
Yashp002 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
| .. _api-objects: | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's generally well known that the length is the number of elements.