Skip to content

Commit 9e84c87

Browse files
move section to proper subheader
1 parent 4a2251e commit 9e84c87

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

docs/static/coding-guidelines.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -182,14 +182,6 @@ Here's why you shouldn't use them:
182182
So, most of the time, and unless you have a really good excuse, don't use global variables.
183183
There are better alternatives to using global variables, described below:
184184

185-
Limit Magic Numbers
186-
-------------------
187-
188-
Magic numbers are special numbers that one might put in code when it is 2AM and it's the 50th time you've recompiled just to get a pixel positioned perfectly.
189-
For example, :code:`x = x + 29 + 52 - 3` contains so-called "magic numbers" -- numbers that aren't tied to a variable or have any real context for why they contain the value they do.
190-
When updating code 6 months down the road, you won't have any clue what these numbers meant.
191-
A better solution is to use a macro such as :code:`#define X_OFFSET (29 + 52 - 3)` where the intent of the numbers is less obscured.
192-
193185
Proper Scoping
194186
^^^^^^^^^^^^^^
195187

@@ -305,6 +297,14 @@ The following tips can help avoid dynamic allocation.
305297
General Guidelines
306298
------------------
307299

300+
Limit Magic Numbers
301+
^^^^^^^^^^^^^^^^^^^
302+
303+
Magic numbers are special numbers that one might put in code when it is 2AM and it's the 50th time you've recompiled just to get a pixel positioned perfectly.
304+
For example, :code:`x = x + 29 + 52 - 3` contains so-called "magic numbers" -- numbers that aren't tied to a variable or have any real context for why they contain the value they do.
305+
When updating code 6 months down the road, you won't have any clue what these numbers meant.
306+
A better solution is to use a macro such as :code:`#define X_OFFSET (29 + 52 - 3)` where the intent of the numbers is less obscured.
307+
308308
Use const as much as possible
309309
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
310310

0 commit comments

Comments
 (0)