This is the mail archive of the gcc-patches@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: Warning patch installed


"Kaveh R. Ghazi" <ghazi@caip.rutgers.edu> writes:

|  > From: Gabriel Dos Reis <gdr@codesourcery.com>
|  > 
|  > Zack Weinberg <zack@wolery.cumb.org> writes:
|  > 
|  > [...]
|  > 
|  > | Perhaps it would be appropriate to annotate free() such that it
|  > | silently accepted constant pointers as well as mutable ones. 
|  > 
|  > That mistake was made during C++ standardization (cf 'delete' according
|  > to ARM C++ and ISO C++).  Please let's not repeat the same mistake.
|  > -- Gaby
| 
| Out of curiousity, why do you consider that a mistake?

A client of a const-pointer shouldn't (logically) be allowed to free() 
the storage the const-pointer is pointing to, without explicitly
subverting the type system.  He is expected to just be inspecting the
pointed object.

-- Gaby
CodeSourcery, LLC		http://www.codesourcery.com

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