Skip to content

Commit 6563706

Browse files
committed
CodingGuidelines: give deadline for "for (int i = 0; ..."
We raised the weather balloon to see if we can allow the construct in 44ba10d (revision: use C99 declaration of variable in for() loop, 2021-11-14), which was shipped as a part of Git v2.35. Document that fact in the coding guidelines, and more importantly, give ourselves a deadline to revisit and update. Let's declare that we will officially adopt the variable declaration in the initializaiton part of "for ()" statement this winter, unless we find that a platform we care about does not grok it. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4c53a8c commit 6563706

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Documentation/CodingGuidelines

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,10 @@ For C programs:
217217
the first statement (i.e. -Wdeclaration-after-statement).
218218

219219
- Declaring a variable in the for loop "for (int i = 0; i < 10; i++)"
220-
is still not allowed in this codebase.
220+
is still not allowed in this codebase. We are in the process of
221+
allowing it by waiting to see that 44ba10d6 (revision: use C99
222+
declaration of variable in for() loop, 2021-11-14) does not get
223+
complaints. Let's revisit this around November 2022.
221224

222225
- NULL pointers shall be written as NULL, not as 0.
223226

0 commit comments

Comments
 (0)