From 0834d9d80be370dd0d995629a300fc8551529022 Mon Sep 17 00:00:00 2001 From: hedara90 <90hedara@gmail.com> Date: Mon, 9 Jun 2025 22:52:37 +0200 Subject: [PATCH] Added loop iterator style (#7092) Co-authored-by: Hedara --- docs/STYLEGUIDE.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/STYLEGUIDE.md b/docs/STYLEGUIDE.md index f53e1a2dcc..dc99be6b1b 100644 --- a/docs/STYLEGUIDE.md +++ b/docs/STYLEGUIDE.md @@ -265,6 +265,15 @@ void SetCurrentDifficultyLevel(enum DifficultyLevel desiredDifficulty) .power = B_UPDATED_MOVE_DATA >= GEN_6 ? 45 : 35, }, ``` +### Variable Declarations +Loop iterators should be declared as part of the loop unless there's a very good reason not to. +```C +for (u32 i = 0; i < LOOP_ITERATIONS; i++) +{ + dst1[i] = i; + dst2[i] = i; +} +``` ## Data Type Sizes When a variable number is used, the data type should generally `u32` (unsigned) or `s32` (signed). There are a few exceptions to this rule, such as: * Values stored in the saveblock should use the smallest data type possible. @@ -350,7 +359,7 @@ enum DifficultyLevel GetCurrentDifficultyLevel(void) } ``` -### Data file format +## Data file format External data files should use JSON.