This is the mail archive of the
mailing list for the GCC project.
Re: -Wconversion versus libstdc++
On 14/01/07, Paolo Carlini <firstname.lastname@example.org> wrote:
>I noticed that -Wconversion now issues warnings in libstdc++.
in a nutshell, what is happening is that a difference of two pointers is
assigned to an unsigned variable. First blush, the warning seems to me a
bit overzealous, but if we concur that this is what we *really* want for
4.3, we can change the affected (very old, indeed) lines of code, no
problem at all.
Wconversion is supposed to warn for conversions that may change a
value. Can the resulting value change when converted to unsigned? If
so, the warning is warranted (I think).
Anyhow, Wconversion needs fine-tuning and I prefer for it to be useful
rather than to literally follow its definition, so if this operation
is quite frequent and safe, I could detect it and avoid the warning.
I am no GCC or C++ expert, so please give me more information on the
issue and feedback from others would be appreciated.