Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2356907pxm; Sun, 27 Feb 2022 19:14:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJyz7nPjEq1g9euRi0w/mxacpBCw1eNBVLjbjNkd3+cMnQ1d6vXuOQkJrm2rLzwul/yYGPjK X-Received: by 2002:a17:902:d512:b0:150:8cc:8bb with SMTP id b18-20020a170902d51200b0015008cc08bbmr18266335plg.107.1646018078325; Sun, 27 Feb 2022 19:14:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646018078; cv=none; d=google.com; s=arc-20160816; b=Ip0h8Wj3cLIOCFJZfXVYYSl0Y8xlc80PLcn8QH1IdG8+/Sy30Cpg6uHVVs6xFOBEb6 iBHNPmVjlz6QrcE0VOebUgSVvW5b8ldUVUoDICnenVHFfYzHlNmoOUQi2OjKZwHNTdqn iRmwb+KunnttKlfnLmV6n995z4Z+C8ji3hcAYJNUVhJoal/+TDjomyyI0ARIhCysItnl zrpXLOKblNlvfb0etC9JYbBXB9tAWiQzOdTBKBjdH0/vYvvzW05dMf8uqwvn813A7e+m 4inTSKFVT05+3XBeUPK6zHfl9CjugeS7DNmeU0aw+RHLXPuO4aYerHezOap/Q36ypSNK 0bPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=uw0quVwktRy8O34fD0h9J2IdIaPd8HFsepLuiZGuQ+4=; b=L09dWlRLb8sTm55hwvPg6OIK5VYp5BLLZ2pfKpAfjYNq5XHB5hWXPxDbTt8ueDjZcP EYXKQvbVZgEy57wdIcfMLP/aY+qDuMkEolb53Uj/DDdhwyyJcm9FQ2L/d+OX+gkrLfT9 DBt3OQ0yP72sfnYMaVUO3PYSgw86HkeNn0Sp/gxtgXzysR/eZyJecVUfNj/w+78hQBnR kHAXtkbi/oAyezGENq3z7aL4SNSs/rH9TnTZ/v4sdYco/IpkiKu3wqH4+2nNFH+ZBmnq /LPJiwPItmM5HmKpNrpR4eoBjL9AqeM4k/7E0t2L4go1zNHVwIqadyqOQnWqeJf2WiKg hrGA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s18-20020a63a312000000b0036c25823419si8143346pge.532.2022.02.27.19.14.22; Sun, 27 Feb 2022 19:14:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231623AbiB0UX4 (ORCPT + 99 others); Sun, 27 Feb 2022 15:23:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229812AbiB0UXz (ORCPT ); Sun, 27 Feb 2022 15:23:55 -0500 Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CD4E83E0EC; Sun, 27 Feb 2022 12:23:17 -0800 (PST) Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 21RKHPMx016218; Sun, 27 Feb 2022 14:17:25 -0600 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 21RKHOOd016217; Sun, 27 Feb 2022 14:17:24 -0600 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Sun, 27 Feb 2022 14:17:24 -0600 From: Segher Boessenkool To: Miguel Ojeda Cc: David Laight , Arnd Bergmann , Linus Torvalds , Jakob , Linux Kernel Mailing List , linux-arch , Greg Kroah-Hartman , Thomas Gleixner , Andy Shevchenko , Andrew Morton , Kees Cook , Mike Rapoport , "Gustavo A. R. Silva" , Brian Johannesmeyer , Cristiano Giuffrida , "Bos, H.J." Subject: Re: [RFC PATCH 03/13] usb: remove the usage of the list iterator after the loop Message-ID: <20220227201724.GZ614@gate.crashing.org> References: <6DFD3D91-B82C-469C-8771-860C09BD8623@gmail.com> <20220226124249.GU614@gate.crashing.org> <20220227010956.GW614@gate.crashing.org> <7abf3406919b4f0c828dacea6ce97ce8@AcuMS.aculab.com> <20220227113245.GY614@gate.crashing.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Feb 27, 2022 at 07:09:03PM +0100, Miguel Ojeda wrote: > On Sun, Feb 27, 2022 at 1:09 PM Segher Boessenkool > wrote: > > > > How will you define dividing by zero so that its behaviour is reasonable > > for every program, for example? > > The solution is to let the developer specify what they need to happen. > That choice should include the unsafe possibility (i.e. unchecked), > because sometimes that is precisely what we need. Requiring to annotate every place that has UB (or *can* have UB!) by the user is even less friendly than having so much UB is already :-( I don't see how you will fit this into the C syntax, btw? > > Invoking an error handler at runtime > > has most of the same unwanted effects, except is is never silent. You > > It may not be what it is needed in some cases (thus the necessity to > be able to choose), but at least one can predict what happens and > different compilers, versions, flags, inputs, etc. would agree. You need a VM like Java's to get even *close* to that. This is not the C target: it is slower than wanted/expected, it is hosted instead of embedded, and it comes with a whole host of issues of its own. One of the strengths of C is its tiny runtime, a few kB is a lot already! I completely agree that if you design a new "systems" language, you want to have much less undefined behaviour than C has. But it is self- delusion to think you can eradicate all (or even most). And there are much bigger problems in any case! If you think that if programmers could no longer write programs that invoke undefined behaviour they will write much better programs, programs with fewer serious functionality or security problems, even just a factor of two better, well... Segher