Valhalla Legends Forums Archive | C/C++ Programming | Having a pointer freed when the calling function exits

AuthorMessageTime
shout
How would I go about creating a function that spits out a pointer to an allocated chunk of memory, then when the calling function exits, free the pointer? I was thinking something like what _alloca() does.
October 7, 2005, 2:46 AM
Myndfyr
Use a managed language?  :P
October 7, 2005, 3:38 AM
shout
[quote author=MyndFyre link=topic=12973.msg130197#msg130197 date=1128656337]
Use a managed language? :P
[/quote]

How helpful.
October 7, 2005, 4:06 AM
K
well, are you using C or C++? if you're using C++, I would recommend using something like std::auto_ptr or for more flexibility, boost::shared_ptr / boost::shared_array
October 7, 2005, 4:25 AM
rabbit
Is boost paying you or something?
October 7, 2005, 5:25 PM
K
[quote author=rabbit link=topic=12973.msg130237#msg130237 date=1128705922]
Is boost paying you or something?
[/quote]

Is there a problem with recommending a free library that accomplishes the result he is looking for?
Do you have anything helpful to add to the discussion or are you just looking to get banned again?
October 7, 2005, 6:26 PM
rabbit
Ech..I was just wondering.  You bring it up a lot.  And I'd prefer not to be banned T.T
October 9, 2005, 7:57 PM

Search