Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1569489rdd; Thu, 11 Jan 2024 03:15:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IH4fC4c4mrAt0FmDIGDF8Kr87evxbBD1UcE0tDmA2KaLQgjPUp2JzxAIjPRFaL67f/ep+n8 X-Received: by 2002:aa7:8b0f:0:b0:6d9:a908:2659 with SMTP id f15-20020aa78b0f000000b006d9a9082659mr843225pfd.62.1704971735547; Thu, 11 Jan 2024 03:15:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704971735; cv=none; d=google.com; s=arc-20160816; b=gHcA6IGxxBJKNZPIe0EwGSm0wwRe9iwBU6pWC6kAWRnZMVXsmLR+dHR57NefPLjT7Z A9FlDkOl7CeKjyKAYsCoGMDdLHVAbO7NkA+AjG6RmelhJmx9yweR6ki5GRIOzxbGE5uM jHqmVLU+UO1nov5NTqHsTNvQVrKkJVGlXVk0fOloCKEtXW0efEuLHgUuLnbEf8vsk0WL 5Z+C/QD/ijnkFwx9OngvwhwueLW+UTbCMI+YUdGatUTmDYRJMAPmTe+MvjLv7DZf2oO/ aDcT+W4UniTqhcRg6VFGToKnykSgWAwWU/zHvQhb0aJNJQkbPBmh8/WxuqzojVbvRw0S i6SA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=j29OWMY+YhlAhxuY2wSmEUDqrXvXRySnRlcR4UOyYDs=; fh=zPO2700TwKgJVORROarjleXly1daO1e/D0x2hkb3ZaE=; b=D3VQtmuuwdzYhfyNnC9C9vk6oq5qSj7qOOOAV413KlKZBPbmWuy3zE/UxtYGp20Dvg 9hSwdLB/iUsq6w23CI2kZc12h1OfbOvhPB0s2Qn39jmB0hI81oVoYSR6GF+KeWeKfube 4cUnWDgIOgmiLOEiJ3aoXkU2i0DKJtQNZnYU2gLMM2DGWSkyqDe6PreCYleOBZN8pk5E sUnyKHJHgaG5o512r93YBxLZgcPHrGMf8M/sgMf5IDOLX7bIitpm1tlWXVLx2MtEq+h0 jD43BgbjGEjGgP9fZbnBb1TeZhqrEOvLFviPXoIcXQ13yhUylh1ercILA8orftBhhzyq FldQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Op2JJO3W; spf=pass (google.com: domain of linux-kernel+bounces-23458-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23458-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id f4-20020a056a00228400b006d9ce7bf4c9si833187pfe.198.2024.01.11.03.15.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 03:15:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-23458-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Op2JJO3W; spf=pass (google.com: domain of linux-kernel+bounces-23458-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23458-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id AA0C2B21666 for ; Thu, 11 Jan 2024 11:12:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 63ECB14F9E; Thu, 11 Jan 2024 11:12:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Op2JJO3W" Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22A9E14F8A for ; Thu, 11 Jan 2024 11:12:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-a27cd5850d6so557175866b.1 for ; Thu, 11 Jan 2024 03:12:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704971552; x=1705576352; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=j29OWMY+YhlAhxuY2wSmEUDqrXvXRySnRlcR4UOyYDs=; b=Op2JJO3W2PqjIFR4T57K8qxVHB+CrH4pPTmqkpDsMjxr1y+O7ktyp0XLn2D0Py/idi FS9HTdedHNiwk4fz9+bnI7Wc/DWK58f72u3segBIMV4H3dwF6OL4uvDCJWSvg97Ham/G oiqtcXzX9tZnIe9R+qlpHMpbtPTBHY1RZ6M9M8ePoLkgmPKOgq093G+Y/jjFcc//9FOv EV6jt28qERF32xFToJWBd7/cyih/Tdmgmdyd/jAaTJo9ATBf6Ko++kk4d+XE+oOOs6X0 BN+ZLUPGG5+TX9UUXPMrPUdIaSICrELsl5DaKC9MqtaQwx4m+q428nPJWr6TeZzVlEia Rayg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704971552; x=1705576352; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=j29OWMY+YhlAhxuY2wSmEUDqrXvXRySnRlcR4UOyYDs=; b=NnftlFO1kJ+hUHfSgDOWU1gy4zbyqW1/RwvYLWBrVk2EKiGJZbW5PTiNTkwAlzADwv NML0fFn+044Qy4fWhHsm1vZ8h+RDnXTTgGS3iABOGEB7bbEOw4dxvBWPr6YKSSsB7gnH MJGcHrfnQ25+H9BWnuHh/5unVZRUglEJhXaB0hqloRbpT4FUL8FAdP2tdfzfbiFzWbwp EGgJIwzoXCG4cDGZc++S6qzOyi2EhtfAa3lAOPOME/aZYltVP3cYb4EXLREBUZRcTTjV Dwca2ZR5vFohTgB9Uv67u+oxdgdwuk6Hzc5awLoYNBJh9PAwWrRkLH7jAk5fs0NIQ3DS jvZg== X-Gm-Message-State: AOJu0Yzpfc+8rU+2NBBz13NHttl68s0LkllccU1R87NN2zprUtQ17CA1 V/MAaNAVCrgWXPSgpVq6ZA== X-Received: by 2002:a17:906:af13:b0:a29:a2d6:4e6d with SMTP id lx19-20020a170906af1300b00a29a2d64e6dmr423020ejb.79.1704971552107; Thu, 11 Jan 2024 03:12:32 -0800 (PST) Received: from p183 ([46.53.248.125]) by smtp.gmail.com with ESMTPSA id ca23-20020a170906a3d700b00a2bd01c2349sm442783ejb.169.2024.01.11.03.12.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 03:12:31 -0800 (PST) Date: Thu, 11 Jan 2024 14:12:29 +0300 From: Alexey Dobriyan To: Neal Gompa Cc: "H. Peter Anvin" , Jason Gunthorpe , jirislaby@kernel.org, dhowells@redhat.com, linux-kernel@vger.kernel.org, pinskia@gmail.com, kent.overstreet@linux.dev Subject: Re: [PATCH 00/45] C++: Convert the kernel to C++ Message-ID: <80cc3496-0a30-4905-9d94-c492abb78c0d@p183> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Thu, Jan 11, 2024 at 05:58:51AM -0500, Neal Gompa wrote: > On Thu, Jan 11, 2024 at 5:56 AM Alexey Dobriyan wrote: > > > > > SFINAE giving inscrutable errors is why I'm saying C++20, > > > since "concept" means you can get usable error messages. > > > > I'd say concepts are irrelevant for the kernel where standard library is > > tightly controlled by the same people who write rest of the kernel and > > no external users. > > > > static_assert() is all you need. > > We have external users all the time, though. People who write external > modules or new modules would fall in that classification. Why should > it be harder for them? static_assert gives filename:line which clearly points to the source of an error. Concepts are SFINAE replacement but if there is little SFINAE there will be little concepts too. Another quite silly thing with concepts (and with noexcept propagation) is that programmer has to write an implementation then chop control flow and put everything else into the requires. And then to keep both in sync. This is an example from cppreference: template requires Addable T add(T a, T b) { return a + b; } Guess what Addable<> is? They are kind of nice for simple things: template concept MinimalIterator = requires(It it) { ++it; *it; it++; };