|
| From: | Markus Armbruster |
| Subject: | Re: [PATCH for-4.2] hw/i386: Fix compiler warning when CONFIG_IDE_ISA is disabled |
| Date: | Mon, 18 Nov 2019 10:25:00 +0100 |
| User-agent: | Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) |
Philippe Mathieu-Daudé <address@hidden> writes:
[...]
> The related question is, is it OK to use size_t to iterate over an array?
>
> for (size_t i = 0; i < ARRAY_SIZE(array); i++) {
> ...
> }
My rule of thumb on integer types is "whatever lets me avoid
not-obviously-safe conversions (implicit ones in particular) with the
least type cast clutter.
Quite often, int fits the bill. But not always.
To reply to your example: depends on what's hiding in the ... :)
> Asking in this thread so we can modify CODING_STYLE accordingly :)
| [Prev in Thread] | Current Thread | [Next in Thread] |