Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

deleting a pointer to a constant object

807575Jan 30 2003 — edited Feb 1 2003
I 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.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 1 2003
Added on Jan 30 2003
2 comments
374 views