home *** CD-ROM | disk | FTP | other *** search
/ Cuteskunk BBS / cuteskunk.zip / cuteskunk / Folklore / c.commandments < prev    next >
Text File  |  2003-06-29  |  2KB  |  49 lines

  1. The Ten Commandments for C Programmers
  2. Henry Spencer
  3.  
  4. 1. Thou shalt run lint frequently and study its pronouncements
  5. with care, for verily its perception and judgement oft exceed thine.
  6.  
  7. 2. Thou shalt not follow the NULL pointer, for chaos and madness
  8. await thee at its end.
  9.  
  10. 3. Thou shalt cast all function arguments to the expected type if
  11. they are not of that type already, even when thou art convinced that
  12. this is unnecessary, lest they take cruel vengeance upon thee when thou
  13. least expect it.
  14.  
  15. 4. If thy header files fail to declare the return types of thy
  16. library functions, thou shalt declare them thyself with the most
  17. meticulous care, lest grievous harm befall thy program.
  18.  
  19. 5. Thou shalt check the array bounds of all strings (indeed, all
  20. arrays), for surely where thou typest 'foo' someone someday shall
  21. type 'supercalifragilisticexpialidocious'.
  22.  
  23. 6. If a function be advertised to return an error code in the event
  24. of difficulties, thou shalt check for that code, yea, even though the
  25. checks triple the size of thy code and produce aches in thy typing
  26. fingers, for if thou thinkest 'it cannot happen to me', the gods
  27. shall surely punish thee for thy arrogance.
  28.  
  29. 7. Thou shalt study thy libraries and strive not to re-invent them
  30. without cause, that thy code may be short and readable and thy days
  31. pleasant and productive.
  32.  
  33. 8.  Thou shalt make thy program's purpose and structure clear to thy
  34. fellow man by using the One True Brace Style, even if thou likest it
  35. not, for thy creativity is better used in solving problems than in
  36. creating beautiful new impediments to understanding.
  37.  
  38. 9. Thy external identifiers shall be unique in the first six
  39. characters, though this harsh discipline be irksome and the years of
  40. its necessity stretch before thee seemingly without end, lest thou tear
  41. thy hair out and go mad on that fateful day when thou desirest to make
  42. thy program run on an old system.
  43.  
  44. 10. Thou shalt foreswear, renounce, and abjure the vile heresy which
  45. claimeth that 'All the world's a VAX', and have no commerce with the
  46. benighted heathens who cling to this barbarous belief, that the days of
  47. thy program may be long even though the days of thy current machine be
  48. short.
  49.