• Advertisement

Archived

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

Use a class destructor to cleanup instead of manually?

This topic is 5252 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

I''m wondering if its ok to use a class destructor to clean up the directx devices etc. Like I have all my direct3d commands in a class, so i thought i could just use the destructor to clean up. Like I have no need to manually do it, only when the program ends. Thanks

Share this post


Link to post
Share on other sites
Advertisement
quote:
Original post by johnnyBravo
I''m wondering if its ok to use a class destructor to clean up the directx devices etc.

Like I have all my direct3d commands in a class, so i thought i could just use the destructor to clean up. Like I have no need to manually do it, only when the program ends.

Thanks

Yeah, in fact, that''s exactly what you should be doing assuming that the interfaces pointers are encapsulated in the object being destructed, of course.

Share this post


Link to post
Share on other sites
Also assuming none of the classes have global or static instances. Only put system level stuff in destructors if you''re 100% certain of WHEN destruction will happen.

With global or static instances that''ll be AFTER you return control from WinMain back to the CRT process startup code.

--
Simon O''Connor
3D Programmer &
Microsoft DirectX MVP

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
http://sourceforge.net/docman/display_doc.php?docid=8673&group_id=9028

you''re heading the right way...

Share this post


Link to post
Share on other sites

  • Advertisement