Nested functions in C (was: Understanding Packages)
Tim Writer
tim-s/rLXaiAEBtBDgjK7y7TUQ at public.gmane.org
Wed Apr 21 19:08:01 UTC 2004
"Lennart Sorensen" <lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org> writes:
> On Tue, Apr 20, 2004 at 04:07:03PM -0400, Henry Spencer wrote:
> > Nope, nested functions aren't legal in C++ either.
> >
> > They *are* legal in Pascal and a number of other languages. Note that the
> > early GNU folks, by and large, did not come from a Unix/C background and
> > consequently felt some of the limitations of C more than experienced C
> > programmers did. Several of their non-standard extensions came out of
> > wanting to make C look a bit more like the languages they grew up on.
>
> Hmm, I really must have used a few weird languages then. I was pretty
> sure I had done nested functions in C++ before, but it sure can't have
> been a standard one (or even g++ by the looks of it). Maybe my memory
> is mixed up with all the pascal code I did many many years ago, or maybe
> stuff from Lisp, ML or some other nice language. :)
Perhaps you're thinking of something like this:
void foo()
{
class bar {
public:
static void baz()
{
/* something */
}
};
/* Invoked "nested function". */
bar::baz();
}
which is legal C++.
--
tim writer <tim-s/rLXaiAEBtBDgjK7y7TUQ at public.gmane.org> starnix inc.
905.771.0017 ext. 225 thornhill, ontario, canada
http://www.starnix.com professional linux services & products
--
The Toronto Linux Users Group. Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
More information about the Legacy
mailing list