From -8029389521258309194
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,fb1a92fa405c930c
X-Google-Attributes: gidf78e5,public
From: James.Kanze@dresdner-bank.com
Subject: Re: nested functions
Date: 1999/06/23
Message-ID: <7k60qd$rgj$1@nnrp1.deja.com>#1/1
X-Deja-AN: 492912513
Approved: Valentin Bonnard <bonnard@clipper.ens.fr>
References: <7jd4c5$nup$1@nnrp1.deja.com> <7jjjr6$r02$1@nnrp1.deja.com> <7jma5c$i85@abyss.West.Sun.COM> <FD38vK.CC4@research.att.com> <37fc8bd2.644752685@nntp.ix.netcom.com>
X-Original-Date: Tue, 15 Jun 1999 17:00:05 GMT
X-Http-User-Agent: Mozilla/4.6 [en] (WinNT; I)
X-Http-Proxy: 1.0 x32.deja.com:80 (Squid/1.1.22) for client 193.194.7.71
Organization: Deja.com - Share what you know. Learn what you don't.
X-Article-Creation-Date: Tue Jun 15 17:00:05 1999 GMT
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBVAwUAN3DNq6wEuYhIxRhxAQGBAQH/ZCT1wW0CyXwBNgbVZs4JmtQZ/XdcsdNG l0R2nxWNtHMtdTa0d4sH8kZcg1nUobHoNfRDlRE3c8arH9yZ5DoH4A== =BC2h
Newsgroups: comp.std.c++

In article <37fc8bd2.644752685@nntp.ix.netcom.com>,
  source@netcom.com (David Harmon) wrote:
>
> On 10 Jun 99 16:20:58 GMT in comp.std.c++, ark@research.att.com
> (Andrew Koenig) wrote:
>
> >> Why do local functions have to have the same calling sequence as
non-local
> >> functions?
> >
> >Because otherwise, you can't define a variable
> >(of type pointer to function) that can potentially
> >contain the address of a local function or a non-local
> >function.
>
> Just like you can't define a variable that can hold both a pointer
> to a member function or a pointer to a non-member function.  A local
> function is actually more like a member function than a non-member
> function, but instead of 'this' it gets a pointer to an implicit
> local context object (AKA display.)

In that case, why not just make it a pointer to member of a class
deriving from __local_scope.

The difference, in both cases, is that the function to which it is
passed as a parameter must know that it is dealing with a local
function/a pointer to member function, and handle it separately.  For a
pointer to member function, this is a requirement anyway, because the
pointer to member function is *not* bound to an instance of the class.
The caller must provide the instance.  A pointer to a local function, on
the other hand, is bound, and can be used exactly like a pointer to any
other function.

--
James Kanze                         mailto:
James.Kanze@dresdner-bank.com
Conseils en informatique orientie objet/
                        Beratung in objekt orientierter
Datenverarbeitung
Ziegelh|ttenweg 17a, 60598 Frankfurt, Germany  Tel. +49 (069) 63 19 86
27


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              ]



