home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / c / 16322 < prev    next >
Encoding:
Internet Message Format  |  1992-11-11  |  2.2 KB

  1. Path: sparky!uunet!mcsun!Germany.EU.net!pki-nbg!hitkw14!smr
  2. From: smr@pki-nbg.philips.de (Stephen Riehm)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: The Correct Way To Write C if-Statements
  5. Message-ID: <smr.721477854@hitkw14>
  6. Date: 11 Nov 92 10:30:54 GMT
  7. References: <140742@lll-winken.LLNL.GOV> <1992Nov9.194915.1647@keinstr.uucp>
  8. Sender: news@pki-nbg.philips.de
  9. Reply-To: smr@pki-nbg.philips.de
  10. Lines: 57
  11.  
  12. chaplin@keinstr.uucp (Roger Chaplin) writes:
  13.  
  14. >Mark Boolootian (booloo@framsparc.ocf.llnl.gov) wrote:
  15. >: 
  16. >: The following piece was written by Jim Minton, an aspiring C programmer.
  17. >: I convinced him to let me post it to the net.  Happy reading and flames
  18. >: to /nev/dull...
  19. >: 
  20. >: 
  21. >: 
  22. >:         The Correct Way To Write C if-Statements
  23. >:                 by
  24. >:                 Jim Minton
  25.  
  26. >[ stuff deleted ]
  27.  
  28. >: The indentation level is 4 spaces!
  29.  
  30. >FWIW, I also happen to prefer 4-space indentation.
  31.  
  32. >Did y'all notice, however, that the title of this piece has been
  33. >centered in the `page' by using TABs, and that each TAB is obviously
  34. >intended to replace 8 spaces?
  35.  
  36. now you're getting confused. The "indentation level is 4 spaces", it
  37. doesn't say 'indentation level is a 4 space tab'.
  38.  
  39. If you use tabs, then there is a 99.9% chance that the next guy that
  40. reads your code will be disgusted by the fact that you used an
  41. indentation level of 8 (since that is the normal tab length).
  42.  
  43. If you are using vi you can use the shiftwidth setting and shifting
  44. commands to indent your code. Also having autoindent set helps.
  45.  
  46. ie: set ai sw=4
  47.  
  48. SHIFT COMMAND    INSERT MODE    COMMAND MODE
  49. -------------    -----------    ------------
  50. indent        ^T        >>
  51. outdent        ^D        <<
  52. no indent    0^D        [no command, use << many times]
  53.  
  54. I don't use emacs, but I have seen emacs users using something
  55. similar.
  56.  
  57. The concept of setting tabs to 4 spaces wide sickens me, simply cus
  58. normally very very very very very few people have tabs set to anything
  59. but 8 characters. (myself included)
  60.  
  61. catchya
  62.  
  63. -----------------------------------------------------------------
  64. Stephen Riehm        Configuration Management       _-_|\ 
  65. smr@pki-nbg.philips.de    Philips Kommunikations Industrie  /     \
  66. Work: +49 911 526 2975    N|rnberg, Germany          \_.-.!/
  67. Fax:  +49 911 526 3678    "I was there, now I am here!"           v 
  68. "My company speaks another language, I CAN'T speak on its' behalf"
  69.