This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: egcs allows deletion of const objects.


Bill Currie <bcurrie@tssc.co.nz> writes:

> Hmm, now *I'm* confused.  I distincly remember gcc (2.7.2.1) complaining
> about deleting a pointer with a const involved

Yep, gcc 2.7 would complain, but the C++ Standard explicitly allows it.

> To me, it just doesn't make sense being allowed to delete a constant
> object because const is meant to be a promise that the object will
> not be modified, and deleting an object definitly modifies it!

Using the same reasoning, you'd conclude that you can't construct a
const object, because you can't write into a const object.  But then
you say: ok, the object becomes constant after the constructor
terminates.  Then I reply: fine, and the object stops being constant
as soon as its constructor starts running, being it invoked by delete
or by some other means.

-- 
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:oliva@gnu.org mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]