Advertisement
thomasjosif

HeLLsGamers SourceMod Formatting Standards

Nov 11th, 2016
341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.51 KB | None | 0 0
  1. HeLLsGamers SourceMod Formatting Standards
  2.  
  3. (1) INDENTATION - Use 4 spaces for each indentation level. No TABs please.
  4.  
  5. (2) BRACES - All braces should appear on their own line. Example - use "ANSI style" / a.k.a. "Allman style" rather than "K&R style".
  6.  
  7. (3) SPACES:
  8. * No excess whitespace around parentheses. Example - use "while(x == y)" rather than "while (x == y)"
  9. * No excess whitespace inside parentheses. Example - use "while(x == y)" rather than "while( x == y )"
  10. * Use spaces around operators (except for i++ and i--) Example - use "a > 1" rather than "a>1".
  11. * Use spaces after inline punctuation. Example 1 - use "a, b, c, d, e" rather than "a,b,c,d,e". Example 2 - use "for(i = 0; i < x; i++)"
  12. instead of "for(i = 0;i < x;i++)"
  13.  
  14. (4) LINE BREAKS:
  15. * Please break lines (both comments and code) exceeding column 150 to the next line.
  16. * The next line(s) should be indented 1 level (4 spaces) in relation to the first line.
  17. * If you want to break lines before column 150, that's up to you.
  18.  
  19. (5) COMMENTS:
  20. * Aside from temporary debugging comments, please do not put trailing comments after a line of code. All comments should be immediatly
  21. above the line(s) of code they describe.
  22. * To delimit main sections, use a line like this: // ###################### SECTION TITLE HERE ######################
  23. * Code comments should be in proper english with proper capitalization and punctuation.
  24. * Single-line comments should have a space after the double slash. Example - "// Description here."
  25.  
  26. (6) VARIABLE NAME CONVENTIONS:
  27. * Global variables should be prefixed with "g_" and then a letter indicating what datatype it is:
  28. - "h" for Handle
  29. - "b" for Bool
  30. - "i" for Int
  31. - "f" for Float
  32. - "s" for String
  33. - (etc)
  34. * On global variables, the next letter, immediatly following the indicator, should be capitalized. Example - g_bMyBool or g_hMyHandle.
  35. * Local variables (including parameters in function definitions) do not have to be prefixed with anything, and can use any convention.
  36. However, please use a consistent convention for all local variables within the same function.
  37.  
  38. (7) FUNCTION NAME CONVENTION - Function names should have EachWordCapitalized().
  39.  
  40. (8) PREPROCESSOR MACRO NAME CONVENTION - Defines should be in ALL_CAPS with underscores delimiting each word.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement