From 8619863723939341005
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/16
Message-ID: <7k5og8$ct1$1@panix.com>#1/1
X-Deja-AN: 490110759
Approved: Fergus Henderson <fjh@cs.mu.oz.au>
References: <081650426190c69CPIMSSMTPU07@email.msn.com> <7k0b01$nod$1@panix.com> <7k3fr2$7el@abyss.West.Sun.COM>
X-Original-Date: 15 Jun 1999 10:38:00 -0400
X-Complaints-To: news@news.unimelb.edu.au
X-Trace: izvestia.its.unimelb.edu.au 929505322 14513 128.250.29.16 (16 Jun 1999 03:55:22 GMT)
Organization: Comeau Computing; http://www.comeaucomputing.com
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUAN2cgFuEDnX0m9pzZAQGGOQF/fIv1/SEtjKkuU/woTckTtS3cFea99f45 Jq9yOow0/QkbY5KQKy+tmA8cZokMNh9g =jqT5
Reply-To: comeau@comeaucomputing.com
NNTP-Posting-Date: 16 Jun 1999 03:55:22 GMT
Newsgroups: comp.std.c++
X-Newsposter: trn 4.0-test55 (26 Feb 97)

In article <7k3fr2$7el@abyss.West.Sun.COM> stanley@West.Sun.COM (Stanley Friesen [Contractor]) writes:
>In article <7k0b01$nod$1@panix.com>,
>Greg Comeau <comeau@comeaucomputing.com> wrote:
>>scope is a syntactic thing.  It doesn't apply to a running program
>>in the same sense.
>
>True - but there is this little rule that variables of automatic *duration*
>are destroyed on exit from their scope.

As I recall the post I responded to, the scope was not existed yet,
and hence why I made this point.

>>  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.
>
>But if the destructors have been called on them, and the sotrage reused for
>some other set of automatic variables (as is allowed upon leaving a function),
>then those pointers generate undefined behavior, as they are pointers to
>variables after their destructors are called.

Again, as I recall the original context, this didn't seem to apply
(my point was to raise that no function was left yet as I recall it).

I do completely agree with your points when they apply though.

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



