Moving the kernel to modern C
Moving the kernel to modern C
Posted Mar 1, 2022 16:27 UTC (Tue) by ianmcc (guest, #88379)In reply to: Moving the kernel to modern C by nybble41
Parent article: Moving the kernel to modern C
In C++ the declaration and the body of the loop are the same scope. In C, initializer in the for loop establishes its own scope, so there are actually two scopes created with a C for loop. This was unintended behavior in C, and a defect report was raised about it, but it seems it wasn't seen as important enough. http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2257.htm...
After all, who would write such code anyway? Its a strange thing to take issue with.
