From 8957371575599324562
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,fb1a92fa405c930c
X-Google-Attributes: gidf78e5,public
From: stanley@West.Sun.COM (Stanley Friesen [Contractor])
Subject: Re: nested functions
Date: 1999/06/16
Message-ID: <7k617d$pt8@abyss.West.Sun.COM>#1/1
X-Deja-AN: 490113691
Approved: Fergus Henderson <fjh@cs.mu.oz.au>
References: <7jd4c5$nup$1@nnrp1.deja.com> <_xh83.25803$wk2.383242@newscene.newscene.com> <082d72743190c69CPIMSSMTPU07@email.msn.com> <7jvh45$5ms$1@engnews1.eng.sun.com>
X-Original-Date: 15 Jun 1999 17:06:53 GMT
X-Complaints-To: news@news.unimelb.edu.au
X-Trace: izvestia.its.unimelb.edu.au 929505582 16408 128.250.29.16 (16 Jun 1999 03:59:42 GMT)
Organization: SunSoft South, Los Angeles, CA
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUAN2chHeEDnX0m9pzZAQGKLwF8CMG9KXwlrT298TBc6p9oRUCsfBsQ593Y 7spSjvwG7NfEaCCAmmucq8U24P7rU8vX =gF3+
NNTP-Posting-Date: 16 Jun 1999 03:59:42 GMT
Newsgroups: comp.std.c++

In article <7jvh45$5ms$1@engnews1.eng.sun.com>,
Steve Clamage <clamage@eng.sun.com> wrote:
>"G.B." <gb@web1.ucar.edu> writes:
>
>>John Potter <jpotter@falcon.lhup.edu> wrote in message
>
>>You can have a var of that type anywhere. I only meant it is useless outside
>>of the scope of parent function.
>
>Huh? You can do it in Pascal, for example.
>
>But using it outside the scope of the parent function would
>be the only point of having local funcitons in C++, it seems
>to me.

I think you and John are meaning different things by "outside the
scope of the parent function".  He took it to mean "the scope of the
parent function has ended due to the function returning".  In that case
what he said is *indeed* correct.   And you cannot call nested functions
like that in Pascal either - the parent function has to be at least *active*.
>
>Maybe you could explain how local functions that could not be
>called from outside the enclosing function scope would be a
>useful addition to C++. What programming problems can be solved
>more easily? It seems to me that a class with member functions
>solves all the same problems, and does a better job of it.

That is my main objection to nested functions - it adds too little for
the pain.
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]



