deleting a pointer to a constant object
807575Jan 30 2003 — edited Feb 1 2003I have code in C++ compiled under Sun WorkShop C++ Compiler 5.0 that is able to delete a pointer to a constant object e.g const int * ptr ;
I'm able to delete it, using delete ptr;
This just a trivial example ... but I'm able to delete a pointer to any constant object. I'm relatively new to C++ so this is very confusing that it should allow me to do so. When I compile the same code in Microsoft VC++ the compiler catches it rightfully saying that it cannot overload the delete operator with a pointer to a constant or something like that ... So my question is is this an anamoly in Sun compiler ... or does the C++ standard loosely defined as to what should happen(. I thought you couldn't overload a delete operator with pointert to a constant) or maybe my shop needs a patch that will solve this problem .... ?
Just tried on Forte same thing happened.
Please Help.