From owner-svn-src-head@freebsd.org Wed Mar 7 15:56:03 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 718F0F39ED3 for ; Wed, 7 Mar 2018 15:56:03 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x235.google.com (mail-io0-x235.google.com [IPv6:2607:f8b0:4001:c06::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 030277C854 for ; Wed, 7 Mar 2018 15:56:03 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x235.google.com with SMTP id e7so3562071ioj.1 for ; Wed, 07 Mar 2018 07:56:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=Rccl7TcY8UI8/MKr29R0/iAkZ3LjYHJVySExvYqtCCs=; b=0tc7kMsHN9GD1ErBiB9CUz3lWrPOJmyWdRonOgafAeCTc/t7AAOop2i1MjuWRY/BtB 3trpVTUApEo/mEcD7QzXAbaf5d3Ljb5DGCnlvav7wAP4sq0rJPfDjTUM5BtwS2pPGizz H7ASLUhcmwG4++W3WIiN9lpHnxsxhwXNnrqLL9wd4C8c1SRB3vpI88Fhq+8/Ve47IWH2 V93Y3rgUf3fVQGqC/fvTeo/bidSyzNYJ1CTuKJeeL+qmzxE1xGdl6X+i+NBy/9cZS2bE wlaYZlNPDFL8faIjMwh6nGskCsBaExOxQNGT7DpYYfxoA+AtqORwH5N7gnOjf4crNRiF sPIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=Rccl7TcY8UI8/MKr29R0/iAkZ3LjYHJVySExvYqtCCs=; b=jZG1I9+LVMamedAwIhXLQnud6ECTclBd72D8OlALoB6OMpp1pUDVeH0yotmJGKV5Nj 5lC6kuc5XuuUWnK54ItsuNTpiZe09/ReGd4Fl/ZJ1wh/ub7xWDViR1sves687tOZB4Tx LKDbuWaiKgGtW3fi8qdrz9HkfHnV3FP0tSpJ7iRavLpzTKBbCS0Kwt2MYz7Dx8YgJeFC wQviwzwb8JdUGEqYgFkxF+hrKWsdyaBrdOEHljiPgnUpVSVJKAJT8VwLoFLpRw+6PwIY Y+EZLgl3L9jRPVJbE0Bx8BWuTljQ23uta3lEQcpl7VtJzViyf71A78z5CrZdvVd+Nv8V 2T4g== X-Gm-Message-State: AElRT7FDeV/9efzm8kp5IyqZlkjnFQWHL7KAImvZJcEC6EcHcYEtluRx 100h2yo+cMe4rHLBHpatG+Hvfp9eeBryf/wyEXqIzA== X-Google-Smtp-Source: AG47ELtFRkGBx9/4MmMF2cTPrSV2Zsy4wes2iKIIS0KuLlFypQuV9Ob7/wOv3C2I1wnH8VuNUlzXlHb3aTKc8RmHMXU= X-Received: by 10.107.180.83 with SMTP id d80mr26215419iof.168.1520438162230; Wed, 07 Mar 2018 07:56:02 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.203.196 with HTTP; Wed, 7 Mar 2018 07:56:01 -0800 (PST) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: References: <201803071447.w27Elh7C053393@repo.freebsd.org> From: Warner Losh Date: Wed, 7 Mar 2018 08:56:01 -0700 X-Google-Sender-Auth: 0bY77ALy3BXRKLwdFOLzz6Fy6jU Message-ID: Subject: Re: svn commit: r330602 - head/sys/compat/cloudabi To: Ed Maste Cc: Eitan Adler , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 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: Wed, 07 Mar 2018 15:56:03 -0000 On Wed, Mar 7, 2018 at 8:44 AM, Ed Maste wrote: > On 7 March 2018 at 09:47, Eitan Adler wrote: > > Author: eadler > > Date: Wed Mar 7 14:47:43 2018 > > New Revision: 330602 > > URL: https://svnweb.freebsd.org/changeset/base/330602 > > > > Log: > > sys/cloudabi: Avoid relying on GNU specific extensions > > > > An empty initializer list is not technically valid C grammar. > > > > MFC After: 1 week > > > > - cloudabi_fdstat_t fsb = {}; > > + cloudabi_fdstat_t fsb = {0}; > > In practice it appears initializing via { 0 } also zeros any padding > in the struct, but I do not believe it's required by the C standard. > Perhaps a language lawyer can weigh in? > All the standard says are that all named are initialized to 0 (which has the usual meaning for the integer 0 for pointers) unless otherwise stated: 6.7.8 para 9: "Except where explicitly stated otherwise, for the purposes of this subclause unnamed members of objects of structure and union type do not participate in initialization. Unnamed members of structure objects have indeterminate value even after initialization." 6.7.8 para 21: "If there are fewer initializers in a brace-enclosed list than there are elements or members of an aggregate, or fewer characters in a string literal used to initialize an array of known size than there are elements in the array, the remainder of the aggregate shall be initialized implicitly the same as objects that have static storage duration." The aggregate here, I believe refers to the elements, not the padded structure, and the padding is definitely an unnamed part of the structure, which makes it unspecified. However 6.7.8 is quite long and detailed, and I'm not 100% sure I have totally grokked all its subtle implications. Commenting on this commit just because it's highlighted by this > change; I do not believe there's a difference between the GNU > extension { } and { 0 } here. > I believe that's correct as well. Warner