Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > what is an escaping variable

Reply
Thread Tools

what is an escaping variable

 
 
C C++ C++
Guest
Posts: n/a
 
      11-12-2007
what is an escaping variable?

 
Reply With Quote
 
 
 
 
Victor Bazarov
Guest
Posts: n/a
 
      11-12-2007
C C++ C++ wrote:
> what is an escaping variable?


A variable the control over whom you're losing?

I don't know of "escaping variable", but there is "escape sequence"
in formatted output...

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask


 
Reply With Quote
 
 
 
 
Roland Pibinger
Guest
Posts: n/a
 
      11-12-2007
On Mon, 12 Nov 2007 15:46:43 -0000, C C++ C++ <m.azmath@...com> wrote:
>what is an escaping variable?


A variable that escapes a function?
http://en.wikipedia.org/wiki/Escape_analysis
BTW, scope bound resource management using RAII is a panacea for
avoiding escaping variables.


--
Roland Pibinger
"The best software is simple, elegant, and full of drama" - Grady Booch
 
Reply With Quote
 
Kira Yamato
Guest
Posts: n/a
 
      11-12-2007
On 2007-11-12 16:56:49 -0500, http://www.velocityreviews.com/forums/(E-Mail Removed) (Roland Pibinger) said:

> On Mon, 12 Nov 2007 15:46:43 -0000, C C++ C++ <m.azmath@...com> wrote:
>> what is an escaping variable?

>
> A variable that escapes a function?
> http://en.wikipedia.org/wiki/Escape_analysis
> BTW, scope bound resource management using RAII is a panacea for
> avoiding escaping variables.


Can you give an example?

--

-kira

 
Reply With Quote
 
Roland Pibinger
Guest
Posts: n/a
 
      11-12-2007
On Mon, 12 Nov 2007 17:01:35 -0500, Kira Yamato
<(E-Mail Removed)> wrote:

>On 2007-11-12 16:56:49 -0500, (E-Mail Removed) (Roland Pibinger) said:
>
>> On Mon, 12 Nov 2007 15:46:43 -0000, C C++ C++ <m.azmath@...com> wrote:
>>> what is an escaping variable?

>>
>> A variable that escapes a function?
>> http://en.wikipedia.org/wiki/Escape_analysis
>> BTW, scope bound resource management using RAII is a panacea for
>> avoiding escaping variables.

>
>Can you give an example?


An example of 'escaping' variables or RAII?

 
Reply With Quote
 
Kira Yamato
Guest
Posts: n/a
 
      11-12-2007
On 2007-11-12 17:53:53 -0500, (E-Mail Removed) (Roland Pibinger) said:

> On Mon, 12 Nov 2007 17:01:35 -0500, Kira Yamato
> <(E-Mail Removed)> wrote:
>
>> On 2007-11-12 16:56:49 -0500, (E-Mail Removed) (Roland Pibinger) said:
>>
>>> On Mon, 12 Nov 2007 15:46:43 -0000, C C++ C++ <m.azmath@...com> wrote:
>>>> what is an escaping variable?
>>>
>>> A variable that escapes a function?
>>> http://en.wikipedia.org/wiki/Escape_analysis
>>> BTW, scope bound resource management using RAII is a panacea for
>>> avoiding escaping variables.

>>
>> Can you give an example?

>
> An example of 'escaping' variables or RAII?


Escaping variable. I just want to see what that code would like.

And perhaps if someone has time, show me what this RAII is and how it
avoids escape variables. But I sense that would be asking for too much.

--

-kira

 
Reply With Quote
 
Roland Pibinger
Guest
Posts: n/a
 
      11-13-2007
On Mon, 12 Nov 2007 18:09:28 -0500, Kira Yamato wrote:
>On 2007-11-12 17:53:53 -0500, (E-Mail Removed) (Roland Pibinger) said:
>> On Mon, 12 Nov 2007 Kira Yamato wrote:
>>> Can you give an example?

>>
>> An example of 'escaping' variables or RAII?

>
>Escaping variable. I just want to see what that code would like.
>
>And perhaps if someone has time, show me what this RAII is and how it
>avoids escape variables. But I sense that would be asking for too much.


From Wikipedia:
"If a subroutine allocates an object and returns a pointer to it, the
object can be accessed from undetermined places in the program — the
pointer has 'escaped'."

MyClass* foo() {
return new MyClass;
}

Escaping has 2 consequences in C++
1. The caller must clean-up (delete) the resource which is impractical
for larger applications.
2. The caller becomes (probably) dependent on MyClass an all types
MyClass depends on (and so forth).

RAII is described here: http://en.wikipedia.org/wiki/RAII .
When you make the desctuctor of the managing object private (as shown
in the RAII example) the managed objects cannot escape from the
enclosing scope.


--
Roland Pibinger
"The best software is simple, elegant, and full of drama" - Grady Booch
 
Reply With Quote
 
Roland Pibinger
Guest
Posts: n/a
 
      11-13-2007
On Tue, 13 Nov 2007 00:02:21 GMT, Roland Pibinger wrote:

>When you make the desctuctor of the managing object private (as shown
>in the RAII example) the managed objects cannot escape from the
>enclosing scope.


Should have been: "When you make the copy constructor of the managing
object private ...". Sorry.

 
Reply With Quote
 
Ian Collins
Guest
Posts: n/a
 
      05-05-2008
Raz wrote:

Please confine your trolling to where it belongs.

--
Ian Collins.
 
Reply With Quote
 
Mike Schilling
Guest
Posts: n/a
 
      05-06-2008
Razii wrote:
> On Mon, 05 May 2008 20:19:18 -0400, CBFalconer
> <(E-Mail Removed)>
> wrote:
>
>> Do you realize that you are posting to comp.lang.c, and that your
>> posts are off-topic there? Simply delete c.l.c from the
>> distribution.

>
> From now on, all my posts would bee cross posted to comp.lang.c.
> What
> are you going to do about it?


As suggested in your post's headers, I'm going to forward this to
(E-Mail Removed) . I encourage the rest of you to join me.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Escaping variable names Kamil Wasilewski Python 0 03-05-2010 05:44 PM
"Variable variable name" or "variable lvalue" mfglinux Python 11 09-12-2007 03:08 AM
How do I scope a variable if the variable name contains a variable? David Filmer Perl Misc 19 05-21-2004 03:55 PM
Re: Escaping a URL in XSL/T Swanand Mokashi ASP .Net 0 05-13-2004 04:58 PM
Escaping ' in Javascript ? Ben ASP .Net 4 11-10-2003 06:22 PM



Advertisments