This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Compiler warnings while compiling gcc with clangâ
- From: Renato Golin <renato dot golin at linaro dot org>
- To: Trevor Saunders <tbsaunde at tbsaunde dot org>
- Cc: Andrew Pinski <pinskia at gmail dot com>, Aditya K <hiraditya at msn dot com>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Tue, 5 May 2015 11:38:12 +0100
- Subject: Re: Compiler warnings while compiling gcc with clangâ
- Authentication-results: sourceware.org; auth=none
- References: <BLU179-W15F1B75976EAA6915DFE1BB6D10 at phx dot gbl> <CA+=Sn1k+1NUE_o2mkWRad_-wgQuQCiyHPmNYc00zeH+N61qZXQ at mail dot gmail dot com> <CAMSE1kciuStXmVRor4Mc=qb78xZYarwdHAAz2xme7L00bajWuw at mail dot gmail dot com> <20150505102348 dot GB21095 at tsaunders-iceball dot corp dot tor1 dot mozilla dot com>
On 5 May 2015 at 11:23, Trevor Saunders <tbsaunde@tbsaunde.org> wrote:
> Saying forward declaration should be done with class is a value choice
> you've made.
Yes.
> Given forward declarations with struct and class are
> interchangable it seems like a perfectly valid choice to me to decide
> you don't care to bother fix up all the forward declaration when you
> change from class to struct.
Indeed.
> or really care about consistancy I guess,
That's my view. And I understand it might not be a common one.
> but it
> seems to me since the code it warns about isn't "wrong" in any real way
> the warning doesn't deserve to be in -Wall or really even in -Wextra.
Absolutely agreed.
However, warnings are not just for errors or even potential errors,
they're to help you write better code, whether you consider "better"
just correct, or easy to read, is open to interpretation.
My view is that being easy to read and consistent goes a long way
towards maintenance and avoiding future errors. I know a lot of
excellent programmers that disagree with me, that's a matter of
opinion.
Having said that, we seems to agree that -Wall is *only* about
potential errors, not clarity. Maybe -pedantic would be a better place
for this warning.
cheers,
--renato