You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

76 lines
3.2 KiB

  1. Acronyms
  2. ~~~~~~~~
  3. * dpkg is a 'word' the first d may be upper case - Dpkg
  4. * APT is a proper Acronym, all upper case please.
  5. Pkg - A Package
  6. Ver - A version
  7. Indenting, Comments, Etc
  8. ~~~~~~~~~~~~~~~~~~~~~~~~
  9. Would make Linus cry :P However it is what I prefer. 3 space indent,
  10. 8 space tab all braces on separate lines, function return on the same line
  11. as the function, cases aligned with their code. The 'indent' options for
  12. this style are:
  13. indent -bl -bli0 -di1 -i3 -nsc -ts8 -npcs -npsl
  14. Each file gets a block at the top that should describe what the file does,
  15. basically a summary of purpose along with any special notes and
  16. attributions. The }}} and {{{ are folding marks if you have a folding
  17. editor such as jed, the function separators are intended to give
  18. a visual separate between functions for easier browsing of the larger files,
  19. or indexed folding if you have such an editor.
  20. Each file should have 1 or 0 primary include files, that include
  21. file must always be the first include file included by the .cc. G++
  22. #pragma interface/implementation is used, as well as anti-include-twice
  23. #ifdefs.
  24. Include files, since there are so many, get their own subdirectory off
  25. the include search path, this is used consistently throughout all the code.
  26. #include "" should never be used for a global exported header file, only
  27. local ones.
  28. C++ Features
  29. ~~~~~~~~~~~~
  30. Due to the legacy compiler heritage, exceptions, RTTI and name spaces are
  31. not used. Templates are used *sparingly* since G++ has traditionally had
  32. very weak support for them, this includes STL templates.
  33. Namespaces will probably be put in the code sometime after G++ 3, which will
  34. be a huge re-org again to make sanity, the majority of all nested things
  35. will go away.
  36. The C++ standard library's non parameterized types (string is included in
  37. this) are used freely when appropriate.
  38. The new C++ #include <iostream> (note the lack of a .h) is used for the
  39. standard library, but not for my code.
  40. Arguments and Ownership
  41. ~~~~~~~~~~~~~~~~~~~~~~~
  42. [much of the code follows this now]
  43. These guidelines should be followed except in two cases.. the first
  44. is where it makes no sense, such as in a casting operator and the second is to
  45. retain API compatibility (this should be rare, since a change in the input
  46. almost always designates a change in ownership rules).
  47. * Pass by value or pass by reference should borrow the object from the
  48. caller
  49. * Pass by non-const reference may be used to indicate a OUT type variable
  50. * Pass by pointer (except in the case where the pointer is really an array)
  51. should be used when the object will be retained or ownership will be
  52. transferred. Ownership transference should be rare and noted by a comment.
  53. * Standard C things (FILE * etc) should be left as is.
  54. * Return by references should indicate a borrowed object
  55. * Return by pointer (except arrays) should indicate ownership is
  56. transferred. Return by pointer should not be used unless ownership is
  57. transferred.
  58. * Return by pointer to variable indicates ownership transfer unless the
  59. pointer is an 'input' parameter (designated generally by an =0,
  60. indicating a default of 'none')
  61. Non-ownership transferring arrays/lists should probably return an iterator
  62. typedef or references..