all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Po Lu <luangruo@yahoo.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Stefan Kangas <stefankangas@gmail.com>,
	 emacs-devel@gnu.org, eggert@cs.ucla.edu
Subject: Re: Using static_assert in Emacs?
Date: Fri, 19 Jul 2024 08:48:40 +0800	[thread overview]
Message-ID: <s54v8129pg7.fsf@yahoo.com> (raw)
In-Reply-To: <865xt2fvrj.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 18 Jul 2024 20:35:44 +0300")

Eli Zaretskii <eliz@gnu.org> writes:

>> 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);
>
> If we have such code (do we?), and if there's a danger that someone
> makes FOO longer but forgets to change buf, such an assertion could be
> useful.  IME, such code is rare, though.

And our convention is to use Gnulib's verify rather than static_assert.



      reply	other threads:[~2024-07-19  0:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-18 15:23 Using static_assert in Emacs? Stefan Kangas
2024-07-18 15:42 ` Eli Zaretskii
2024-07-18 16:39   ` Stefan Kangas
2024-07-18 16:51     ` Collin Funk
2024-07-18 17:35     ` Eli Zaretskii
2024-07-19  0:48       ` Po Lu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s54v8129pg7.fsf@yahoo.com \
    --to=luangruo@yahoo.com \
    --cc=eggert@cs.ucla.edu \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=stefankangas@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.