Linux -Blue forest free software | Return to home page | Site Map | Search WWW | Contact Us |
Your current position : Homepage > Free Software > Technological exchanges >Application Programming


    

Blue Forest http://www.lslnet.com at 10:18 on June 6, 2006


The new Heavy

#include "Cstddef>;
#include "Iostream>;
Using namespace std;
Class X (
Int Rifa
Public :
X (int ii) : i (ii) (
Cout<< "this=" "<this<<endl;
        }   
~X () (
Cout<< "X : : ~X" "<this<<endl;
        }
Void* operator new (size_t, void* loc)
(Return loc;
        }
    };
Int main ()
{int L[10];// the array is allocated on the stack?
Cout<< "l =" "<l<<endl;
X=new *. (1) X (47);
: : X->;X ~X () ;// implementation of the language is not a problem? After dropping the phrase still in normal operation.
}

The new Heavy

Stack is in the array.
You called this new placement. Not simply new.
You can manually implement dtor, you need not implement it. Because you are new to the system memory is allocated from the array on the stack. So at the end of the procedure when the system will recover memory, and your manual will result in run-time analysis of the structure (or not defined) behavior. You do not get through because of the new memory structure on I can accept why to analyze it.

The new Heavy

This is the C + + programming examples of thinking is certainly correct. If manual analysis of the implementation of structural function, structure function analysis will be deployed. But memory or automatic recovery.

The new Heavy

Ah, I have the wrong. Imagine delete go. Analysis of the structure is to be done. Call analysis shows the general structure will not function. Only do so with new placement.



 Privacy Policy  Copyright © 1999-2000 LSLNET.COM. All rights reserved. Blue Forest website owners. E-mail : Webmaster@lslnet.com