Re: Psuedo-dynamic allocation?
From: Robbie Hatley (loneXwolfintj_at_pacXbell.net.remove-Xs-include-)
Date: 05/07/04
- Next message: John Harrison: "Re: Psuedo-dynamic allocation?"
- Previous message: John Harrison: "Re: Calling a function in another class"
- In reply to: John Harrison: "Re: Psuedo-dynamic allocation?"
- Next in thread: John Harrison: "Re: Psuedo-dynamic allocation?"
- Reply: John Harrison: "Re: Psuedo-dynamic allocation?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 7 May 2004 01:31:05 -0700
"John Harrison" <john_andronicus@hotmail.com> wrote in message news:2g0s9iF33ql5U1@uni-berlin.de...
> (answers to my fears re. memory leaks)
Thanks for the clarification.
> ... Yes. But I'd quibble about your terminology. make_pair does not create
> anything dynamically, that would imply use of new, which make_pair does not
> use....
Ah, you mean "dynamically" in the sense of creating objects which still
exist after the code that created them goes out of scope:
void Dweevil (unsigned check)
{
double * Qbert = new unsigned double;
... (hundreds of lines of code) ...
return;
} // leave scope
// Oops! Forgot to delete Qbert ! Memory leak!
I meant "dynamic", however, in the sense of not specifying in advance
how many objects will be created or what their names will be.
This is the kind of thing I'd call "pseudo-dynamic":
struct Glurk
{
char broil;
long shot;
}
void Bard (double bubble)
{
list<Glurk> Grendel;
if (bubble > 19.7)
{
Grendel.push_back(Glurk()); // pseudo-dynamically create new Glurk
}
... (hundreds of lines of code) ...
return;
} // leave scope, free memory.
This can be a very useful concept, I'm beginning to see.
-- Cheers, Robbie Hatley Tustin, CA, USA email: lonewolfintj at pacbell dot net web: home dot pacbell dot net slant earnur slant ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
- Next message: John Harrison: "Re: Psuedo-dynamic allocation?"
- Previous message: John Harrison: "Re: Calling a function in another class"
- In reply to: John Harrison: "Re: Psuedo-dynamic allocation?"
- Next in thread: John Harrison: "Re: Psuedo-dynamic allocation?"
- Reply: John Harrison: "Re: Psuedo-dynamic allocation?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|