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]
Other format: [Raw text]

Re: [PATCH]: Fix problematic -Wcast-qual cases using new CONST_CAST macro


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

| On Fri, 27 Jul 2007, Richard Guenther wrote:
| 
| > On 7/27/07, Kaveh R. GHAZI <ghazi@caip.rutgers.edu> wrote:
| > > Sure.  Besides my main point which is silencing -Wcast-qual warnings, the
| > > CONST_CAST macro is grep-able.  I.e. you can search for the few places
| > > where it's used and audit if they are correctly applied.  You cannot do
| > > that with regular C-style casts.  Another reason is that with C-style
| > > casts there isn't any indication of why it's there.  The CONST_CAST macro
| > > comments itself to someone reading the code.  (These are some of the
| > > rationales for the creation of C++'s cast operators.)  The macro isn't
| > > type-safe like the C++ operator is, but it's a poor man's C option. :-)
| >
| > Ha!  Maybe a reason to switch to C++ ;)  How about

Indeed :-)

[...]

| Also, I don't believe the main sources are compilable with a C++ compiler
| at this point anyway.  Only the libiberty/ and gcc/cp/ directories use
| -Wc++-compat AFAICT.
| 
| So may I install the latest version of my patch?

OK for the diagnostics part (not the system.h).

-- Gaby


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