PDA

View Full Version : free delete crash?



Mr_Smith
03-13-2002, 02:03 PM
i have
class TEXTURE
{
GLubyte *ImageData;
}

then in the deconstructor i have
free(ImageData); but it crashes any ideas?

And from my knowledge i believe
free is for vars and
delete is for class's
yet i have seen them interchanged, does anyone know the exact definitions, that someone like me would understand http://www.opengl.org/discussion_boards/ubb/smile.gif

Damon
03-13-2002, 02:51 PM
Try asking this beginner C++ question in a more appropriate forum.
http://groups.google.com/groups?hl=en&group=comp.lang.c%2B%2B

richardve
03-13-2002, 02:55 PM
Unfortunately this is way offtopic, but I can give you some hints:

free() should be used together with malloc()
delete should be used with new

And you should learn the basics of C++ before diving straight into the middle of the programming sea.

FAQ (http://www.parashift.com/c++-faq-lite/) you!

(inside joke)


[This message has been edited by richardve (edited 03-14-2002).]

Mr_Smith
03-14-2002, 07:16 AM
I tried but no one seemed to know befor and everywhere i looked people just confuse me by throwing them in everywhere and not for what i though was true and u just said was true, and thats basically what i though they should be used for.

Thx