From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa4.mentor.iphmx.com (esa4.mentor.iphmx.com [68.232.137.252]) by sourceware.org (Postfix) with ESMTPS id ED8B83858426 for ; Thu, 11 May 2023 21:43:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ED8B83858426 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="5.99,268,1677571200"; d="scan'208";a="5026789" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa4.mentor.iphmx.com with ESMTP; 11 May 2023 13:43:55 -0800 IronPort-SDR: zOdNArBLMfW2DnkTfP2ikxcqWj0SqC7CthgmwmAjhNwGED2Gz8Qty0m8PUF6FN6LE7V9A/EvPE +xmG0OBpaHpNdSmHzVBcvmtKG6YXrgyQN4JwXePADr0Ocw0U3zNGTqdKEypXytRNDZZEvDIErO 4KlZLKXmXDgxIdeKCHIFR5E4Kwhevb3t+/8hbN0TPPvqkRen6AxzK2+los9Ubc1zgykEHH7vou +YbqWl8iHve0kWXNqFsVx32KAgG1STtl7m/Q/pd3DudUAFHfpngfrM6et3y3WOZnEjwfcgJQt9 ehU= Date: Thu, 11 May 2023 21:43:49 +0000 From: Joseph Myers To: Kees Cook CC: Alejandro Colomar , GCC , Alejandro Colomar , Andrew Clayton , Andrew Clayton , Subject: Re: [wish] Flexible array members in unions In-Reply-To: <202305111410.CFE0875F@keescook> Message-ID: References: <44940599-7b43-99f6-5b09-4f050d645c7b@gmail.com> <202305111158.C78642624@keescook> <74ee73d2-04e-ea8-9430-93929446e925@codesourcery.com> <202305111410.CFE0875F@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-15.mgc.mentorg.com (139.181.222.15) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-3106.8 required=5.0 tests=BAYES_00,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Thu, 11 May 2023, Kees Cook via Gcc wrote: > Why are zero-sized objects missing in Standard C? Or, perhaps, the better > question is: what's needed to support the idea of a zero-sized object? Zero-sized objects break the principle that different objects have different addresses, and the principle of being able to subtract pointers to different elements of an array. There would also be serious C++ compatibility concerns, since C++ allows a struct with no members but it has nonzero size, unlike the GNU C extension where a struct with no members has size zero. -- Joseph S. Myers joseph@codesourcery.com