From -8601110306905583704
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,fb1a92fa405c930c
X-Google-Attributes: gidf78e5,public
From: gbush@my-deja.com
Subject: Re: nested functions
Date: 1999/06/11
Message-ID: <7jro7p$ntt$1@nnrp1.deja.com>#1/1
X-Deja-AN: 488552110
X-NNTP-Posting-Host: 146.225.126.244
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>
X-UID: 0000000001
X-Status: $$$T
X-Http-User-Agent: Mozilla/4.0 (compatible; MSIE 4.01; Windows NT)
X-Http-Proxy: 1.1 x31.deja.com:80 (Squid/1.1.22) for client 146.225.126.244
Organization: Deja.com - Share what you know. Learn what you don't.
X-Article-Creation-Date: Fri Jun 11 19:32:09 1999 GMT
Newsgroups: comp.std.c++
Originator: clamage@taumet


In article <lz%73.9759$wk2.183779@newscene.newscene.com>,
  jpotter@falcon.lhup.edu (John Potter) wrote:
> Functions by their nature are not auto, they are static.
Well, I believe the question of the nature of functions is not settled.
C++ can fix some of the problems of C. And obviously, local functions
as well as any other local objects should exist only in the scope where
they are defined.

> Or did you mean that returning a pointer to a local function would
> need to be made a special case and disallowed?  So assign it to a
> global variable.  Disallow that also?  Pass it to another function
> which makes the assignment.  Disallow passing it to another function?
> That was the reason for wanting it.

Assignment of the local f-n ptr to the global var should be diagnosed
as an error by compiler. The warning must be given when the pointer to
the local f-n is returned by f-n. The same way as compiler gives
warning if f-n returns ptr or ref to the local obj.
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.
Gene.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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




