home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / c / 16978 < prev    next >
Encoding:
Internet Message Format  |  1992-11-21  |  1.4 KB

  1. Path: sparky!uunet!usc!rpi!psinntp!psinntp!dg-rtp!sheol!throopw
  2. From: throopw@sheol.UUCP (Wayne Throop)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: question about duplicate declarations
  5. Summary: possible use for function declarations inside function bodies
  6. Message-ID: <722322699@sheol.UUCP>
  7. Date: 21 Nov 92 02:13:48 GMT
  8. References:  <2R28E4L@math.fu-berlin.de> <27543@dog.ee.lbl.gov>
  9. Lines: 26
  10.  
  11. :: From: rene@hamel.uucp (Rene Mueller)
  12. :: Message-ID: <2R28E4L@math.fu-berlin.de>
  13. :: So code like
  14. ::    typ f1(paramlist) { typ f2(paramlist); ... }
  15. :: Shouldn't be in ANY programm...
  16.  
  17. : From: torek@horse.ee.lbl.gov (Chris Torek)
  18. : Message-ID: <27543@dog.ee.lbl.gov>
  19. : (Stylistically, I happen to agree; function declarations with block
  20. : scope provide nothing that the same declaration with file or global
  21. : scope would give, except the chance to make a mistake.)
  22.  
  23. I can think of a legitimate use of the construct.  And that is to
  24. encourage the compiler to give warnings when a function is used from 
  25. a location that the developer did not intend.
  26.  
  27. Eg:       void portable_foo(void){
  28.               void host_specific_foo(void);
  29.               host_specific_foo();
  30.           }
  31.  
  32. This records the developer's intent to use portable_foo everywhere else
  33. in the program (even in other functions in the same file), in order
  34. to localize the "infection" of the use of the host-specific function.
  35. --
  36. Wayne Throop  ...!mcnc!dg-rtp!sheol!throopw
  37.