From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.devel Subject: Re: Using static_assert in Emacs? Date: Thu, 18 Jul 2024 09:39:43 -0700 Message-ID: References: <867cdig0zu.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19451"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org, eggert@cs.ucla.edu To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jul 18 18:40:27 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sUUB9-0004uC-7X for ged-emacs-devel@m.gmane-mx.org; Thu, 18 Jul 2024 18:40:27 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sUUAZ-000116-A5; Thu, 18 Jul 2024 12:39:51 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sUUAX-0000p4-1v for emacs-devel@gnu.org; Thu, 18 Jul 2024 12:39:49 -0400 Original-Received: from mail-lj1-x22b.google.com ([2a00:1450:4864:20::22b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sUUAV-0005Ta-9n; Thu, 18 Jul 2024 12:39:48 -0400 Original-Received: by mail-lj1-x22b.google.com with SMTP id 38308e7fff4ca-2eefe705510so11978021fa.1; Thu, 18 Jul 2024 09:39:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721320785; x=1721925585; darn=gnu.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=/7N7me6+lpcqvvyp9etPTUdv+xNUz8brcVxwBTFNGDs=; b=Hp49soeyBvoOBSmYdR3dLYWtVtrh04oZGOwpJARR9Dd3srNKBnbFUs4CXlJyDzYY2Q kumDPcPMMWXJtXgH1pf1vH0o6ix7X0or10HItvg5p2VjYEuyPlSMznbfjmy/PsvpE/X3 syPPujSfPoMaiodcqkVccXSpOPnrDJIBWx0/X4rM+5yMjDYFrApmA93IjSrs7AjRDnKh y5ZRxEYZ822CgRDEdZ8IZBtMZoKdUBsdoJNZypdFyPKWpMR1zLrXmkDTTOsNzBkEHZ8Y t6N9O6mRQskyK4wBZ1mVyQ5ez07MlUxbIP0ZpDPQ9/kVpU2xb+U4KMyo8H8ol2SJxRse y6CQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721320785; x=1721925585; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/7N7me6+lpcqvvyp9etPTUdv+xNUz8brcVxwBTFNGDs=; b=MdyP8F9tSjxOt0imkzBi+I72WcBn/LFt86dhcqcnmoUW8+IFhtZ0P0P/kMKCTGB7Ow dptFyzp1+U2OT/07BASxzedHnxM2OavoYq/hzctvzl6qmVlEgCptAWsi/ebZ0HViYG19 z8cYg96y/hg2hEy6QvxxK2gq0boW1RCcVxpvvmboAJFN5lYT8MrqtZS0sHmLi2UupTiC 0vrtEH69UTNfPosniDUXNcOLNO8gq2mcQ4j5dkriqwjMhJ0btioEdMoZBKtJD3jlC/Tm khFeljElXNYgShEyVW7Pw+zob9tqJvN9afy+NV3uRvhgpbom+1yOXB31yiTfYN7bBAhT Yrvw== X-Gm-Message-State: AOJu0YyBDzvVKzfYSKJ/4v025u47qhumCsqTScjeXm5+V3b9hwkpASLh OuJ5/Ez8YMta0b5rvNI1EhJmbfVV2MWv+KkfWo9Ati6LMs3b6nN2rPyndQlkCigPq5s1sakMGOn SuFUnFKxkVMLD7yL/fNXQvh+odEgg3XGO17k= X-Google-Smtp-Source: AGHT+IHMBXu6m61mQ+XC9iQXEUNNp5yDSN0iokASilK+YK/atuwODiAV5IeP6QizQBGmdYo+B2iZomp3MIfE7LCSqWI= X-Received: by 2002:a2e:8813:0:b0:2ec:568e:336e with SMTP id 38308e7fff4ca-2ef05c52c7emr22364181fa.1.1721320784720; Thu, 18 Jul 2024 09:39:44 -0700 (PDT) Original-Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Thu, 18 Jul 2024 09:39:43 -0700 In-Reply-To: <867cdig0zu.fsf@gnu.org> Received-SPF: pass client-ip=2a00:1450:4864:20::22b; envelope-from=stefankangas@gmail.com; helo=mail-lj1-x22b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:321800 Archived-At: Eli Zaretskii writes: > We already have it in config.h, so we can use it. (Gnulib actually > uses it, see lib/*.c.) Good to know, thanks. > The real question is: where and how will that be useful? I'm looking at something like this, where the sizes are known at compile time: #define FOO "some text" static_assert (sizeof buf >= sizeof FOO); memcpy (buf, FOO, sizeof FOO);