From owner-freebsd-current@FreeBSD.ORG Fri Jul 27 11:28:20 2012 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 93968106566C for ; Fri, 27 Jul 2012 11:28:20 +0000 (UTC) (envelope-from phk@phk.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id 130428FC14 for ; Fri, 27 Jul 2012 11:28:20 +0000 (UTC) Received: from critter.freebsd.dk (unknown [192.168.48.2]) by phk.freebsd.dk (Postfix) with ESMTP id AB8833B6B9; Fri, 27 Jul 2012 11:20:49 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.14.5/8.14.5) with ESMTP id q6RBKmW1009655; Fri, 27 Jul 2012 11:20:49 GMT (envelope-from phk@phk.freebsd.dk) To: Luigi Rizzo From: "Poul-Henning Kamp" In-Reply-To: Your message of "Fri, 27 Jul 2012 11:38:24 +0200." <20120727093824.GB56662@onelab2.iet.unipi.it> Content-Type: text/plain; charset=ISO-8859-1 Date: Fri, 27 Jul 2012 11:20:48 +0000 Message-ID: <9654.1343388048@critter.freebsd.dk> Cc: current@freebsd.org Subject: Re: (void)foo or __unused foo ? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Jul 2012 11:28:20 -0000 In message <20120727093824.GB56662@onelab2.iet.unipi.it>, Luigi Rizzo writes: >The alternative way to avoid an 'unused' warning from the compiler >is an empty statement > > (void)foo; The thing I don't like about this form, is that it doesn't communicate your intention, only your action. Somewhere down my TODO list I have an item to propose instead: typedef void unused_t; int main(int argc, char **argv) { (unused_t)argc; (unused_t)argv; return (0); } -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence.