This is the mail archive of the
mailing list for the GCC project.
Re: Re: patch: don't issue -Wreorder warnings when order doesn't matter
- From: Daniel Marjamäki <daniel dot marjamaki at gmail dot com>
- To: gcc at gcc dot gnu dot org
- Date: Fri, 29 Jul 2011 12:55:53 +0200
- Subject: Re: Re: patch: don't issue -Wreorder warnings when order doesn't matter
> Why doesn't it matter in this case but it matters when the initializer
> are non-constant?
It doesn't matter because the program will behave the same no matter
if the initializations are reordered or not. Logically it will behave
just as the user expects no matter if he expects reordering or not.
When one initializer is non-constant there might be a dependency
between the two initializations and the wrong order might be a bug.
I would like to silence such warnings also, but I don't want to try to
determine if there is dependencies or not.
> If you don't want to fix up your code, just compile it with -Wno-reorder.
I don't want to use -Wno-reorder , because then I won't see the real
problems. Don't get me wrong, I like this check.
When gcc generates noise I think it is better to fix gcc than to fix my code.
The only reason I can think of to keep this noise is for purely
stylistic reasons. Somebody might think it is a stylistic problem to
initialize members backwards. But then -Wreorder should also warn
about common assignments and I doubt anybody wants that.