From owner-svn-src-head@freebsd.org Mon Feb 22 19:57:15 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EA56BAB1518; Mon, 22 Feb 2016 19:57:15 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (glebi.us [96.95.210.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id B77401CF6; Mon, 22 Feb 2016 19:57:15 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id u1MJvEEb037116 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 22 Feb 2016 11:57:14 -0800 (PST) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id u1MJvELK037115; Mon, 22 Feb 2016 11:57:14 -0800 (PST) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Mon, 22 Feb 2016 11:57:14 -0800 From: Gleb Smirnoff To: Conrad Meyer Cc: Benjamin Kaduk , Alan Somers , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , Sergey Kandaurov , "src-committers@freebsd.org" Subject: Re: svn commit: r295768 - head/usr.sbin/iostat Message-ID: <20160222195713.GC1945@FreeBSD.org> References: <201602182008.u1IK81vg092127@repo.freebsd.org> <20160219230612.GR1945@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Feb 2016 19:57:16 -0000 On Fri, Feb 19, 2016 at 04:50:40PM -0800, Conrad Meyer wrote: C> > It is not quite as simple as this would make it sound. The elements or C> > members of an aggregate (e.g.) structure type are initialized as if it were C> > an object of static storage duration (i.e., to zero) if the initializer list C> > does not contain enough initializers for all members of the aggregate type, C> > per item 21 of section 6.7.8 of n1256.pdf. However, such initialization C> > does not necessarily need to zero any padding bytes that are present, which C> > may take unspecified values. Personally, I think this particular clang C> > warning can be too aggressive, especially for complex structs, but on the C> > other hand given the indeterminateness of padding, bzero/memset are often a C> > better choice anyway. C> C> By definition, padding byte contents are unused. There is no reason C> their values matter one way or another, so why do we care about the C> distinction between bzero and member zero initialization? Well, one can run bcmp() or a hashing function over entire structure, in that case contents of padding matter. But I still don't want to see this warning in -Wall, since it kills very useful C99 initializers. The code, that runs bcmp() or hashes over structs, should take care, and we shouldn't pessimize the entire build for its sake. -- Totus tuus, Glebius.