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