https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85858

--- Comment #2 from Mike Sharov <msharov at users dot sourceforge.net> ---
(In reply to Jonathan Wakely from comment #1)
> (In reply to Mike Sharov from comment #0)
> > When the pointer is const, it can not point to owned memory
> Why not?

Because a const pointer can not be freed. By "owned memory" I mean memory that
was explicitly allocated by the object, which I assume was the situation that
Effective C++ rule was referring to, or memory the ownership of which was
passed to the object. In both cases the object has to keep a non-const pointer
in order to be able to free it or to pass on the ability to free it to some
other object. I can't think of any case for an owned const pointer; can you?

Reply via email to