This is the mail archive of the gcc@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: Compiler warnings while compiling gcc with clangâ


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


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