home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / c / 11751 < prev    next >
Encoding:
Internet Message Format  |  1992-07-30  |  1.3 KB

  1. Path: sparky!uunet!mcsun!uknet!gdt!bsmail!smee
  2. From: smee@bristol.ac.uk (Paul Smee)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Functions Within Functions
  5. Message-ID: <1992Jul30.100457.21742@bristol.ac.uk>
  6. Date: 30 Jul 92 10:04:57 GMT
  7. References: <Bs5w39.5ox@news.larc.nasa.gov>
  8. Reply-To: P.Smee@bristol.ac.uk (Paul Smee)
  9. Organization: University of Bristol
  10. Lines: 17
  11.  
  12. In article <Bs5w39.5ox@news.larc.nasa.gov> wjb@cscsun2.larc.nasa.gov (William J. Bene) writes:
  13. >Is there any way to declare functions within another function like in pascal?
  14.  
  15. Quick answer is 'no', not as such.  (And, it's a feature of PL/1 which I'd
  16. grown to love, and miss now I've turned to C.)
  17.  
  18. Longer answer is that depending on exactly what effect you are after
  19. (and perhaps on 'style' rules within your organisation) it is often
  20. possible to simulate the effect by using 'static' functions.  If you
  21. declare a function as such (e.g. 'static int getfred (args) {... etc')
  22. when you define it, then it is only accessible to other functions which
  23. are contained within the same source file, and which can't be called by
  24. functions which were compiled in separate source files.
  25.  
  26. -- 
  27. Paul Smee, Computing Service, University of Bristol, Bristol BS8 1UD, UK
  28.  P.Smee@bristol.ac.uk - ..!uunet!uknet!bsmail!p.smee - Tel +44 272 303132
  29.