This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Warning patch installed
- To: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Subject: Re: Warning patch installed
- From: Gabriel Dos Reis <gdr at codesourcery dot com>
- Date: 04 May 2000 22:12:45 +0200
- Cc: zack at wolery dot cumb dot org, egcs-patches at egcs dot cygnus dot com
- Organization: CodeSourcery, LLC
- References: <200005041939.PAA11055@caip.rutgers.edu>
"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