diff options
Diffstat (limited to 'docs/style-guide.txt')
-rw-r--r-- | docs/style-guide.txt | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/docs/style-guide.txt b/docs/style-guide.txt index 25c676ca2..915d9b27d 100644 --- a/docs/style-guide.txt +++ b/docs/style-guide.txt | |||
@@ -266,7 +266,7 @@ these steps: | |||
266 | conversion. | 266 | conversion. |
267 | 267 | ||
268 | - Compile and see if everything still works. | 268 | - Compile and see if everything still works. |
269 | 269 | ||
270 | Please be aware of changes that have cascading effects into other files. For | 270 | Please be aware of changes that have cascading effects into other files. For |
271 | example, if you're changing the name of something in, say utility.c, you | 271 | example, if you're changing the name of something in, say utility.c, you |
272 | should probably run 'examples/mk2knr.pl utility.c' at first, but when you run | 272 | should probably run 'examples/mk2knr.pl utility.c' at first, but when you run |
@@ -293,13 +293,13 @@ Use 'const <type> var' for declaring constants. | |||
293 | #define var 80 | 293 | #define var 80 |
294 | 294 | ||
295 | Do this instead, when the variable is in a header file and will be used in | 295 | Do this instead, when the variable is in a header file and will be used in |
296 | several source files: | 296 | several source files: |
297 | 297 | ||
298 | const int var = 80; | 298 | const int var = 80; |
299 | 299 | ||
300 | Or do this when the variable is used only in a single source file: | 300 | Or do this when the variable is used only in a single source file: |
301 | 301 | ||
302 | static const int var = 80; | 302 | static const int var = 80; |
303 | 303 | ||
304 | Declaring variables as '[static] const' gives variables an actual type and | 304 | Declaring variables as '[static] const' gives variables an actual type and |
305 | makes the compiler do type checking for you; the preprocessor does _no_ type | 305 | makes the compiler do type checking for you; the preprocessor does _no_ type |
@@ -336,7 +336,7 @@ The Folly of #ifdef | |||
336 | Code cluttered with ifdefs is difficult to read and maintain. Don't do it. | 336 | Code cluttered with ifdefs is difficult to read and maintain. Don't do it. |
337 | Instead, put your ifdefs at the top of your .c file (or in a header), and | 337 | Instead, put your ifdefs at the top of your .c file (or in a header), and |
338 | conditionally define 'static inline' functions, (or *maybe* macros), which are | 338 | conditionally define 'static inline' functions, (or *maybe* macros), which are |
339 | used in the code. | 339 | used in the code. |
340 | 340 | ||
341 | Don't do this: | 341 | Don't do this: |
342 | 342 | ||
@@ -650,7 +650,7 @@ line in the midst of your #includes: | |||
650 | And a code block similar to the following near the top of your applet_main() | 650 | And a code block similar to the following near the top of your applet_main() |
651 | routine: | 651 | routine: |
652 | 652 | ||
653 | while ((opt = getopt(argc, argv, "abc")) > 0) { | 653 | while ((opt = getopt(argc, argv, "abc")) > 0) { |
654 | switch (opt) { | 654 | switch (opt) { |
655 | case 'a': | 655 | case 'a': |
656 | do_a_opt = 1; | 656 | do_a_opt = 1; |