From 6361512437660982020
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,fb1a92fa405c930c
X-Google-Attributes: gidf78e5,public
From: jpotter@falcon.lhup.edu (John Potter)
Subject: Re: nested functions
Date: 1999/06/12
Message-ID: <_xh83.25803$wk2.383242@newscene.newscene.com>#1/1
X-Deja-AN: 488691534
X-NNTP-Posting-Host: 209.173.98.136
Approved: stephen.clamage@sun.com (comp.std.c++)
References: <7jd4c5$nup$1@nnrp1.deja.com> <7jjjr6$r02$1@nnrp1.deja.com> <7jma5c$i85@abyss.West.Sun.COM> <37dd56e1.565652003@nntp.ix.netcom.com> <lz%73.9759$wk2.183779@newscene.newscene.com> <7jro7p$ntt$1@nnrp1.deja.com>
X-Trace: newscene.newscene.com 929146106 209.173.98.136 (Fri, 11 Jun 1999 19:08:26 CDT)
Organization: Newscene Public Access Usenet News Service (http://www.newscene.com/)
NNTP-Posting-Date: Fri, 11 Jun 1999 19:08:26 CDT
Newsgroups: comp.std.c++
Originator: clamage@taumet


gbush@my-deja.com wrote:

: No problems with passing a ptr to the local f-n to another f-n, as long
: as that f-n doesn't break any of the previous constraints, and call is
: originated in the scope where local f-n is defined.

Consider:

void f (SomeUndecidedType* p);
void g () {
   void h () { }
   f(h);
   }

We need a type for that function pointer or f can not be declared.
Now that we have a type for it, there is no reason for not having
variables of that type anywhere.

Pascal had special rules for function parameters.  That was ok
because Pascal did not have pointers to functions.  We are not
talking about Pascal.

How will you integrate your great local functions into the overall
C++ language?

Please consider a common extension which starts threads using a
function as the "main" of the thread.  I once used a Pascal
implementation which had this feature and started threads using
local functions.  The result was total destruction of the display
and absolutely useless programs.  I then implemented the idea in
C and C++ with very nice results.  I have never missed local
functions since.

John



[ 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              ]




