2
0
mirror of git://git.code.sf.net/p/openocd/code synced 2025-08-16 17:57:47 +10:00

helper: types: fix proper return type in example of ARRAY_SIZE()

The example in the comment above the declaration of the macro
ARRAY_SIZE() assigns the value to a variable of type 'unsigned'
that is not allowed by the coding style (should be 'unsigned int')
and is not correct since the macro uses 'sizeof()' and the type
returned is 'size_t'.

Fix the comment.

Change-Id: I18c32b5328a229ab74b56dafab46a064ce5d23c5
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8970
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
This commit is contained in:
Antonio Borneo 2025-06-21 12:11:24 +02:00
parent 6631419beb
commit 13b74c3fc7

View File

@ -51,7 +51,7 @@
* Compute the number of elements of a variable length array.
* <code>
* const char *strs[] = { "a", "b", "c" };
* unsigned num_strs = ARRAY_SIZE(strs);
* size_t num_strs = ARRAY_SIZE(strs);
* </code>
*/
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))