Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ Moderated > deleting non-co...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 4 Topic 9742 of 9909
Post > Topic >>

deleting non-constructed objects

by Sarang <sarangbaheti@[EMAIL PROTECTED] > Jun 25, 2008 at 05:58 PM

Hi,

If I try to delete the malloced pointer what can be expected
behaviour?

The code pasted along with works may be because the struct J is a POD
but don't know what are the various implications of the same.

#include <memory>

struct J
{
     int i;
     int j;
};

int main()
{
     J* jj = (J*)malloc(sizeof(J));
     delete jj;

     return 0;
}

Thanks,
Sarang

-- 
      [ See http://www.gotw.ca/resources/clcm.htm
for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]
 




 4 Posts in Topic:
deleting non-constructed objects
Sarang <sarangbaheti@[  2008-06-25 17:58:40 
Re: deleting non-constructed objects
Chris Uzdavinis <cuzda  2008-06-26 03:31:02 
Re: deleting non-constructed objects
Thomas Richter <thor@[  2008-06-26 03:45:33 
Re: deleting non-constructed objects
Gerhard Menzl <clcppm-  2008-06-26 04:27:56 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Aug 20 4:38:38 CDT 2008.