Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Scarface5013

free class* ??

This topic is 6085 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
quote:
Original post by Arild Fines
Hmm... they don''t teach English in German schools, do they?

Actually, they do.

Scarface, was mochtest du? Vielleicht ich kann dir hilfen... Meine deutsche ist nicht mehr so gut, aber ich glaube ich kenn (ja?) genug.

I wanna work for Microsoft!
[ GDNet Start Here | GDNet Search Tool | GDNet FAQ | MS RTFM [MSDN] | SGI STL Docs | Google! ]
Thanks to Kylotan for the idea!

Share this post


Link to post
Share on other sites
ok guys, i know it''s unbeliveable but they ARE teaching english in german schools and university. but i''m not sure, if you heart something about sozial contacs and behavior. i''m so sorry, if my literary knowledge is not corresponding to yours. so don''t call me a fool for not knowing any vocabulary of informatic field. perhaps you can teach me something, i''m not sure, but i thought i''m here to do. first i thought i visit this forum to learn something about programming, but we can rename it in "GOTO english" or "english in 21 days".

but i''m getting of topic. so i want to explane my question in a proper way, in hope someone there will understand my foolish english.

i started to write my one gui in dx and therefor i declared a new class. this class owns to attributes of this class in a list. in code :

class CXWindow
{
CXWindow *child;
CXWindow *parent;
}

after some calls and adds the chil and parent is pointing to a list of objects. the next step i started is deleting some of these. so i have to free the memory. but i''m not sure how. i think i use a runpointer to the object i want to delete and call:
free( runpointer );
runpointer = NULL;
that''s right ??

i hope this way to explane my problem is more proper than the last one and no one is bored.

thx

Share this post


Link to post
Share on other sites
You tell ''em Scarface ^_^ People seem to bash each other/call each other newbie based on language problems *way* too often... I could understand your question immediatly, strange as though it might seem from the other replies. Can''t anwser it though. I''ll just lurk around ''till I see the anwser though ^_^

Share this post


Link to post
Share on other sites
Well how did you allocate the objects? Did you use new for this? I hope you didn''t use malloc.
So when using new to create an object simply use delete to destroy the object on the heap.

Share this post


Link to post
Share on other sites
OK....

  
class X
{
//stuff

};

void main()
{
// Set to NULL on initialising

X* pSomething = NULL;

// Creating the object

pSomething = new X;

// Destroying the object

delete pSomething;
pSomething = NULL;
}


For safely deleting objects, I made the following useful macro:

  
#define DELETENULL(obj) { if (obj) { delete [] (obj); (obj) = NULL; } }


Hope this helps This is C++ only though. In C you don''t have new/delete, so you would use the old-school malloc/free

Share this post


Link to post
Share on other sites
quote:
Original post by dusik
For safely deleting objects, I made the following useful macro:


#define DELETENULL(obj) { if (obj) { delete [] (obj); (obj) = NULL; } }


What does the "if (obj)" test add? If you call delete or delete[] with a null pointer, the result is a no-op.



--
Very simple ideas lie within the reach only of complex minds.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!