From 3216067946910662817
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,fb1a92fa405c930c
X-Google-Attributes: gidf78e5,public
From: comeau@panix.com (Greg Comeau)
Subject: Re: nested functions
Date: 1999/06/13
Message-ID: <7k0b01$nod$1@panix.com>#1/1
X-Deja-AN: 489156501
Approved: Valentin Bonnard <bonnard@clipper.ens.fr>
References: <7jrqf5$op5$1@nnrp1.deja.com> <7jrv0r$dfq$1@engnews1.eng.sun.com> <081650426190c69CPIMSSMTPU07@email.msn.com>
X-Original-Date: 13 Jun 1999 09:16:49 -0400
Organization: Comeau Computing; http://www.comeaucomputing.com
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBVAwUAN2P0MqwEuYhIxRhxAQHWvgH+MDZPJiKxQf3DYyH+yAlnZp0XoUYPOqWU Tus7wamC1ELJvDz1O8V+944DljgozY6ulX8lAEqDDLTrEYRozfL2tQ== =nOnk
Reply-To: comeau@comeaucomputing.com
Newsgroups: comp.std.c++
X-Newsposter: trn 4.0-test55 (26 Feb 97)

In article <081650426190c69CPIMSSMTPU07@email.msn.com> "G.B." <don't.even.think.about.it@isgate.is> writes:
>
>
>Steve Clamage <clamage@eng.sun.com> wrote in message
>news:7jrv0r$dfq$1@engnews1.eng.sun.com...
>>
>> Function f is not visible outide this translation unit, yet
>> can be called from other translation units via pf. Varible
>> k is not visible outside function foo, yet can be accessed
>> even from other translation units via pi.
>>
>Ah, the quirks of C. I have better used the word accessible instead of
>visible. Sorry, I'm just a software engineer so my terminology is not very
>precise.
>The difference between local and global fiunctions is that the first can
>access local variables (including parent function parameters) in the scope
>where they are defined. These local variables simply do not exist when you
>leave the scope, so calling local function out of it parent's scope doesn't
>make sense.

scope is a syntactic thing.  It doesn't apply to a running program
in the same sense.  So, when you say the local vars do not exist when
you leave the scope, they will if the local function calls a different
function, perhaps passing or having pointers to the local vars.

- Greg
-- 
       Comeau Computing, 91-34 120th Street, Richmond Hill, NY, 11418-3214
     Producers of Comeau C/C++ 4.2.38 -- New Release!  We now do Windows too.
    Email: comeau@comeaucomputing.com / Voice:718-945-0009 / Fax:718-441-2310
                *** WEB: http://www.comeaucomputing.com *** 
---
[ 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              ]



