From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com [68.232.129.153]) by sourceware.org (Postfix) with ESMTPS id 88D633857C42 for ; Mon, 15 Nov 2021 22:47:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 88D633857C42 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com IronPort-SDR: TNAob0GNu9Cvpxgu0ztU5iKnx7Cff/pcA9j+jnEkvcoilY5d7ECIDkI/myv0J6itDCQaNDyXv5 43TO0WtF4Pwua/Ug0S3uHp1rnt6GvkQTikFMQlC/VnQUi89Hdmfbfs8CJ9maPjfkYz4x7RLOKh muPTiHHF8xRcL++xKKny26agSM0KkErxHeRVzJ0BDjKTSWA6QuTDUddm7RpTka2ohnDu3cqqir KOaRLryi/lM3YFkemCFxeZ26yS8nXdXre/XSUeFOkAV6lR3V7f9Jl+1zXprrkLZfhHArpss6pL P31YcZwOiloOm6oI6rfwddwZ X-IronPort-AV: E=Sophos;i="5.87,237,1631606400"; d="scan'208";a="70974295" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa1.mentor.iphmx.com with ESMTP; 15 Nov 2021 14:47:28 -0800 IronPort-SDR: PM4K+kRu3uOQFq1iPKve6YLloqmiP1bo9pT210/cmJa+tgWzhIw3F91SPmzUDcDHBjdmRhqvwc lRSK5H4RPro45zKDCQqMN+5g91Z3MWgKBb+rjqt9OkXhsrQ7pvoplJiZd4qjKpq8txXVf6nT0L eHKvK/XQFtFmlJULZ1IChThihjCsIUKSi4/xgz6e6zP1hDfZuRhK8eoo6PuoXrY7/73lzSn7WE xN+H8lSWFPzzoDzcnKkmb1Pr1yhlGdoXAsPvu9aUZvcnu7E4C8UtfghjDHCI6PwahHUqgVPU5j oGg= Date: Mon, 15 Nov 2021 22:47:22 +0000 From: Joseph Myers X-X-Sender: jsm28@digraph.polyomino.org.uk To: "Alejandro Colomar (man-pages)" CC: , Subject: Re: ISO C3X proposal: nonnull qualifier In-Reply-To: <4883fa8c-2d99-2611-a8e2-6c7612283da4@gmail.com> Message-ID: References: <56a1a945-608e-0e5e-7610-c35481abb980@gmail.com> <4883fa8c-2d99-2611-a8e2-6c7612283da4@gmail.com> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-05.mgc.mentorg.com (139.181.222.5) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-3116.8 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Nov 2021 22:47:29 -0000 On Mon, 15 Nov 2021, Alejandro Colomar (man-pages) via Gcc wrote: > Hi Joseph, > > On 11/15/21 23:17, Joseph Myers wrote: > > On Mon, 15 Nov 2021, Alejandro Colomar (man-pages) via Gcc wrote: > > > > > How is restrict handling that problem of lvalue-to-rvalue already? > > > > restrict has tricky rules about "based on" (6.7.3.1). > > Hmm, I think I can "base on" that, > to define what I had in mind. :) "based on" is about optimizations; I think it's even less suited to anything relating to diagnostics than it is to optimization. To restrict assignment between different kinds of pointers, I'd think you'd want pointer type variants that differ in some way *other* than qualifiers, a way that's unaffected by lvalue-to-rvalue conversion, but that comes with its own rules on implicit conversion as if by assignment (6.5.16.1) (though then you also need to work out what's allowed in terms of mixing these pointer type variants in all the other operations allowing pointers, what type results of pointer arithmetic have, etc.). And there should surely also be some way of converting a normal pointer to this variant with a runtime check for NULL. Note that discussion of prior art in such a proposal should also consider relevant prior art (for constraining possible values of a variable through the type system) in C++ or other languages if possible. -- Joseph S. Myers joseph@codesourcery.com