Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id C8214431FD0 for ; Thu, 22 Dec 2011 11:26:10 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ks22cHkMpbJE for ; Thu, 22 Dec 2011 11:26:10 -0800 (PST) Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 2F5E8431FB6 for ; Thu, 22 Dec 2011 11:26:10 -0800 (PST) Received: by wgbds13 with SMTP id ds13so13454952wgb.2 for ; Thu, 22 Dec 2011 11:26:07 -0800 (PST) Received: by 10.227.198.142 with SMTP id eo14mr11556285wbb.28.1324581967582; Thu, 22 Dec 2011 11:26:07 -0800 (PST) Received: from hotblack-desiato.hh.sledj.net (host81-149-164-25.in-addr.btopenworld.com. [81.149.164.25]) by mx.google.com with ESMTPS id dd4sm25033396wib.1.2011.12.22.11.26.05 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 22 Dec 2011 11:26:06 -0800 (PST) Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000) id 165AC9FBB6; Thu, 22 Dec 2011 19:26:04 +0000 (GMT) To: Austin Clements Subject: Re: [RFC][PATCH] notmuch: Workaround to allow ignoring non-void function return. In-Reply-To: <20111222190305.GA324@mit.edu> References: <1324503532-5799-1-git-send-email-dme@dme.org> <20111222070345.GI10376@mit.edu> <20111222190305.GA324@mit.edu> User-Agent: Notmuch/0.10.2+107~ga2d0215 (http://notmuchmail.org) Emacs/24.0.92.1 (x86_64-pc-linux-gnu) From: David Edmondson Date: Thu, 22 Dec 2011 19:25:59 +0000 Message-ID: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Cc: notmuch@notmuchmail.org X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2011 19:26:10 -0000 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Thu, 22 Dec 2011 14:03:05 -0500, Austin Clements wrot= e: > > In general I agree, but what would we do if writing an error message to > > stderr fails? >=20 > This was discussed on IRC, but calls to write(2) should never be bare. > I believe it's marked warn_unused_result not because libc is so > concerned with people checking for error returns (otherwise all sorts > of things would be marked warn_unused_result) but because even a > successful write can be a short write. Hence, not checking the result > is a bug, even if you don't care about errors. As I said, the principle is sound. What would do in this specific case? static void handle_sigint (unused (int sig)) { static char msg[] =3D "Stopping... \n"; write(2, msg, sizeof(msg)-1); interrupted =3D 1; } Just this? if (write(2, msg, sizeof(msg)-1) { /* Appease the compiler. */; } --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iEYEARECAAYFAk7zhEcACgkQaezQq/BJZRb5sgCeKPmw3UKPGWKTOOdvLd++mdzi awYAnRhOee2FLXQ5B/kilH9RWbxL/Nn6 =a06T -----END PGP SIGNATURE----- --=-=-=--