2011/7/29 Daniel Marjamäki <daniel.marjam...@gmail.com>:
> Hello!
>
>> 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.

If the initializer is constant, but the member value that's being
initialized has a
non-trivial constructor with a side effect, your patch will inhibit the warning
but the program will not behave the same as if reordering had not happened.

Peter

Reply via email to