Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualxiajia

Posted 16 January 2013 - 09:51 AM

Thank you very much for your advice.
about 2:it's true that "delete" already checks if the pointer is "NULL".(I do not know whether all compilers are like this. But vs2005 is indeed the case.)
but "delete" not set the pointer to "NULL"


 

int *p = new int[100];
delete []p;
delete []p; // this is a runtime error

The actual situation may be more complicated than this.

about 3:Linked content is very good (yet not try to use), but I've seen about "boost::scoped_ptr","boost::shared_ptr","boost::scoped_array","boost::shared_array","boost::weak_ptr","boost:: intrusive_ptr:, so be a bit confusing to me.


#3xiajia

Posted 16 January 2013 - 09:49 AM

Thank you very much for your advice.
about 2:it's true that "delete" already checks if the pointer is "NULL".(I do not know whether all compilers are like this. But vs2005 is indeed the case.)
but "delete" not set the pointer to "NULL"



int *p = new int[100];delete []p;delete []p; // this is a runtime error
The actual situation may be more complicated than this.

about 3:Linked content is very good (yet not try to use), but I've seen about "boost::scoped_ptr","boost::shared_ptr","boost::scoped_array","boost::shared_array","boost::weak_ptr","boost:: intrusive_ptr:, so be a bit confusing to me.

#2xiajia

Posted 16 January 2013 - 09:48 AM

Thank you very much for your advice.
about 2:it's true that "delete" already checks if the pointer is "NULL".(I do not know whether all compilers are like this. But vs2005 is indeed the case.)
but "delete" not set the pointer to "NULL"



int *p = new int[100];delete []p;delete []p; // this is a runtime error
The actual situation may be more complicated than this.

about 3:Linked content is very good (yet not try to use), but I've seen about "boost::scoped_ptr","boost::shared_ptr","boost::scoped_array","boost::shared_array","boost::weak_ptr","boost:: intrusive_ptr:, so be a bit confusing to me.

#1xiajia

Posted 16 January 2013 - 09:40 AM

Thank you very much for your advice.

about 2:it's true that "delete" already checks if the pointer is "NULL".(I do not know whether all compilers are like this. But vs2005 is indeed the case.)

but "delete" not set the pointer to "NULL"

 

 

 

 

int *p = new int[100];
delete []p;
delete []p; // this is a runtime error

 

The actual situation may be more complicated than this.


PARTNERS