[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using static_assert in Emacs?
From: |
Po Lu |
Subject: |
Re: Using static_assert in Emacs? |
Date: |
Fri, 19 Jul 2024 08:48:40 +0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
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.