What are the two steps that happen while i say delete p?, C/C++ Programming

Assignment Help:

A: N delete p is a two-step procedure: it calls the destructor, and then releases the memory. The code developed for delete p is functionally similar to this (supposing p is of type Fred*):

// Original code: delete p;

if (p != NULL) { p->~Fred(); operator delete(p);

}                                              

The statement p->~Fred() calls the destructor for the Fred object pointed to by p.

The statement operator delete(p) calls memory deallocation primitive, void operator delete(void* p). This primitive is same in spirit to free(void* p). (Note down, however, that these two are not interchangeable; for example there is no guarantee that the two memory deallocation primitives even employ the same heap!)

 


Related Discussions:- What are the two steps that happen while i say delete p?

#c++ homework, write c++programm that converts degrees Kelvin (TK) to degr...

write c++programm that converts degrees Kelvin (TK) to degrees Fahrenheit(TR) recall that TF=(9/5)TK and that TF=TR-459.67

C, minimum total number of shelves.

minimum total number of shelves.

Bubble sort, sample of program that use in bubble sort using assignment ope...

sample of program that use in bubble sort using assignment operator in c++

Integration, to find the area under the curve y = f(x) between x = a and x ...

to find the area under the curve y = f(x) between x = a and x = b

Minimum shelf, how to find minimum number if shelves required

how to find minimum number if shelves required

C with thread , #I have assignment c with unix thread multiplication progr...

#I have assignment c with unix thread multiplication program ..

Write a program to illustrate the call by reference, Write a Program to ill...

Write a Program to illustrate the Call by Reference? Here is an illustration: #include . int compute_sum(int *n); int main( void) { int n=3, sum; printf("%d\n",n); /

Prepare a mt4 ea to clone mt4 trades to a binary options, Prepare a MT4 EA ...

Prepare a MT4 EA to clone MT4 Trades to a Binary Options Platform Project Description: I want an EA that clones MT4 Trades to Globaltrader365, GT Options and if possible othe

Write procedure that compute recursive method, A function f is defined by t...

A function f is defined by the rule that f(n) = n if 0≤n≤3 and f(n) = f(n - 1) + 2f(n - 2) + 3f(n - 3) if n> 3. (a) Write a procedure that computes f by means of a recursive pro

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd