| Deutsch English Français Italiano |
|
<vehd3l$r08h$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!news.roellig-ltd.de!open-news-network.org!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Thiago Adams <thiago.adams@gmail.com>
Newsgroups: comp.lang.c
Subject: Re: constexpr keyword is unnecessary
Date: Sun, 13 Oct 2024 18:12:21 -0300
Organization: A noiseless patient Spider
Lines: 39
Message-ID: <vehd3l$r08h$1@dont-email.me>
References: <veb5fi$3ll7j$1@dont-email.me>
<vebp8r$3ok6d$1@raubtier-asyl.eternal-september.org>
<vebpo5$3olu3$1@dont-email.me>
<vebtjp$3p9sm$1@raubtier-asyl.eternal-september.org>
<vebubq$3p8oj$1@dont-email.me> <20241013093902.884@kylheku.com>
<veh0ks$p3c4$1@dont-email.me> <20241013112004.698@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 13 Oct 2024 23:12:22 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="b9d5dd9688ffdaba1d061cdfa3066275";
logging-data="885009"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18vWQR4NXG/o36Ze+rGdpLbdwG5GT8rQw8="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:L/X8YV7pJgDfLGN2GoIVrTvCv/g=
In-Reply-To: <20241013112004.698@kylheku.com>
Content-Language: en-GB
Bytes: 2040
Em 10/13/2024 3:21 PM, Kaz Kylheku escreveu:
> On 2024-10-13, Thiago Adams <thiago.adams@gmail.com> wrote:
>>>> What I am suggesting again is remove the keyword constexpr. make const
>>>> do that.
Related:
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3333.htm
I believe clang is already extending const power in more scenarios.
https://godbolt.org/z/h1ha5jfPn
struct X{
int i;
};
int main()
{
const struct X x2 = (struct X){.i=1};
static_assert(x2.i == 1);
}
https://godbolt.org/z/EW797PjEq
struct X{
int i;
};
int main()
{
const int a[] = {1, 2};
const struct X x2 = (struct X){.i=a[0]};
static_assert(x2.i == 1);
}