qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [5275] Suppress gcc 4.x -Wpointer-sign (included in -Wa


From: Andreas Färber
Subject: Re: [Qemu-devel] [5275] Suppress gcc 4.x -Wpointer-sign (included in -Wall) warnings
Date: Tue, 28 Oct 2008 18:38:31 +0100


Am 28.10.2008 um 17:54 schrieb Ian Jackson:

Blue Swirl writes ("[Qemu-devel] [5275] Suppress gcc 4.x -Wpointer- sign (included in -Wall) warnings"):
-        ret = sprintf(phys_ram_base + (16 << 20) - 256,
+        ret = sprintf((char *)(phys_ram_base + (16 << 20) - 256),

I realise I'm a bit late with this comment (my apologies), but:

I think this shows that it would be better to suppress the warning
with the appropriate compiler option, than to try to update the code.

IMO the warning is a mistake since representational compatibility
between corresponding signed and unsigned types is certain for any
platform qemu could plausibily support.

And these kind of casts are dangerous because they can suppress
serious warnings about pointer/integer mismatch.

Not sure what type phys_ram_base had here, but char can be signed or unsigned depending on platform and this often leads to warnings on, e.g., OSX. Suppressing all signedness warnings could hide real mistakes, too...

Andreas





reply via email to

[Prev in Thread] Current Thread [Next in Thread]