RE: [Dev-C++] Deliberate crashes - more information
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Ioannis V. <no...@ho...> - 2002-04-08 23:59:44
|
It's all theoretical, you may try to place data in address you assume allocated too. From my experience making it 0 doesn't protect you in reality if you do not know what is going on. :) The last thing you will do on a pointer assuming it points to allocated space is to delete it. Before you will try to read/write from there (and boom even if it is 0). So the real solution to such problems is to know what is going on in the code. For knowing what is going on, keep code separated inside small functions each of one doing some specific job. There are ways for bullet-proof code but it is not yet the time for you to think of them, just keep learning and keep experimenting with C++ as you are doing. Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.cjb.net <http://www.noicys.cjb.net/> * Alternative URL: http://run.to/noicys -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Bob Wilson Sent: Tuesday, April 09, 2002 1:52 AM To: Dev-C++ User Mailing List Subject: Fw: [Dev-C++] Deliberate crashes - more information >> Why call delete an an already deleted pointer in the first place and why to assign it to zero and call delete on it? :) << Intentionally? There is no reason. Unintentionally, there is no reason either, but the possibility of an accidental second delete on a non null pointer increases with the size and complexity of the program and the number of programmers involved with the project. |