home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / software / 5039 < prev    next >
Encoding:
Text File  |  1992-12-17  |  1.8 KB  |  58 lines

  1. Newsgroups: comp.software-eng
  2. Path: sparky!uunet!pmafire!mica.inel.gov!whg
  3. From: whg@inel.gov (Bill Gray)
  4. Subject: Re: C Code Layout
  5. Message-ID: <1992Dec17.171815.1699@inel.gov>
  6. Sender: news@inel.gov
  7. Organization: Idaho National Engineering Laboratory, Idaho Falls, Idaho
  8. References: <1992Dec15.023235.17090@seq.uncwil.edu> <45360002@hpcuhe.cup.hp.com>
  9. Date: Thu, 17 Dec 92 17:18:15 GMT
  10. Lines: 46
  11.  
  12. In article <45360002@hpcuhe.cup.hp.com>, defaria@hpcuhe.cup.hp.com (Andy DeFaria) writes:
  13. |> ... 
  14. |>     if (condition) {
  15. |>        statement;
  16. |>     } /* if */
  17. |> ...
  18. |> 
  19. |>     if (condition) {
  20. |>        statement;
  21. |>     } else {
  22. |>        statement;
  23. |>     } /* if */
  24.  
  25. My $0.02:
  26.  
  27.     if  ( condition )  {
  28.         stuff;
  29.     }/* if  */
  30.     ^   ^^
  31.         The closing comment lines up with "stuff".
  32.     The closing "}" lines up with the opening "if".
  33.  
  34.  
  35.     if  ( condition )  {
  36.         stuff;
  37.     }/* if  */
  38.     else  {
  39.         more_stuff;
  40.     }/* else */
  41.  
  42. Sometimes,  if it's longer and more complex than it should be, the
  43. closing comment includes the condition:
  44.  
  45.     }/* if ( condition ) */
  46. ========== long legal disclaimer follows, press n to skip ===========
  47.  
  48. Neither the United States Government or the Idaho National Engineering
  49. Laboratory or any of their employees, makes any warranty, whatsoever,
  50. implied, or assumes any legal liability or responsibility regarding any
  51. information, disclosed, or represents that its use would not infringe
  52. privately owned rights.  No specific reference constitutes or implies
  53. endorsement, recommendation, or favoring by the United States
  54. Government or the Idaho National Engineering Laboratory.  The views and
  55. opinions expressed herein do not necessarily reflect those of the
  56. United States Government or the Idaho National Engineering Laboratory,
  57. and shall not be used for advertising or product endorsement purposes.
  58.