
30 Mar
2022
30 Mar
'22
7:08 p.m.
On Wed, Mar 30, 2022 at 8:05 PM Sean Anderson seanga2@gmail.com wrote:
On 3/30/22 1:01 PM, Andy Shevchenko wrote:
On Wed, Mar 30, 2022 at 7:49 PM Sean Anderson seanga2@gmail.com wrote:
...
#define for_each_console_dev(i, file, dev) \
for (i = 0, dev = console_devices[file][i]; \
When we enter the loop, the dev is assigned and perhaps valid
i < cd_count[file]; \
i++, dev = console_devices[file][i])
for (i = 0; i < cd_count[file] && \
Not the case anymore.
The loop condition is evaluated before we enter the loop, which includes the first assignment to dev.
Yeah, I just sent a reply to my reply :-)
(dev = console_devices[file][i]); i++)
So, what I don't like is exactly this hidenness, which I have stumbled upon.
--
With Best Regards,
Andy Shevchenko