[Python-Dev] cpython (3.2): Avoid the compiler warning about the unused return value.

Gregory P. Smith greg at krypto.org
Sun Jan 22 00:02:58 CET 2012

On Sat, Jan 21, 2012 at 2:33 PM, Stefan Krah <stefan at bytereef.org> wrote:
> Benjamin Peterson <benjamin at python.org> wrote:
>> > Can't that give you another warning about the ssize_t being truncated to
>> > int?
>> > How about the following instead?
>> >
>> >   (void) write(...);
>> Also, if you use a recent enough version of gcc, ./configure will
>> disable the warning. I would prefer if stop using these kinds of
>> hacks.
> Do you mean (void)write(...)? Many people think this is good practice,
> since it indicates to the reader that the return value is deliberately
> ignored.

Unfortunately (void) write(...) does not get rid of the warning.

Asking me to change the version of the compiler i'm using is
unfortunately not helpful.  I don't want to see this warning on any
common default compiler versions today.

I am not going to use a different gcc/g++ version than what my distro
provides to build python unless we start making that demand of all
CPython users as well.

It is normally a useful warning message, just not in this specific case.


More information about the Python-Dev mailing list